local Coins = workspace:WaitForChild("Coins")
local touched = {}
for _, Coin : Part in pairs(Coins:GetChildren()) do
if Coin:IsA("BasePart") then
Coin.Touched:Connect(function(hit)
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
if Player then
local leaderstats:Folder = Player:WaitForChild("leaderstats")
if leaderstats then
if touched[Coin.Name] then return end
touched[Coin.Name] = true
leaderstats.Coins.Value += 1
game.Debris:AddItem(Coin, .1)
end
end
end)
end
end
when I collect more coins it doesn't work