local Y={}local function k(k,z)if Y[z]==k then return end Y[z]=k PlayerData.AdjustCoins(k,COIN_VALUE)Remotes.CollectCoin:FireClient(k,z,COIN_REGEN_DELAY)wait(COIN_REGEN_DELAY)Y[z]=nil end

local collectedCoins = {}

local function processCoinTouch(player, coin)
	
	-- Check if the coin has already been collected
	if collectedCoins[coin] == player then
		return -- Does nothing with the coin if it didnt respawn yet
	end
	
	collectedCoins[coin] = player --Sets the Player who collected the coin
	
	PlayerData.AdjustCoins(player, COIN_VALUE)
	Remotes.CollectCoin:FireClient(player, coin, COIN_REGEN_DELAY)

	wait(COIN_REGEN_DELAY)

	-- Remove the coin from the table of collected coins once it respawns
	collectedCoins[coin] = nil
end

