local db = true script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") ~= nil then if db == true then db = false script.Parent.Transparency = 1 local player = game.Players:GetPlayerFromCharacter(hit.Parent) player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 1 script.Sound:Play() script.Parent.Transparency = 1 wait(5) db = true script.Parent.Transparency = 0 end end end)
I tested this out myself, and it works. Also, I fixed parts in your script
local db = true script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") ~= nil then if db then db = false script.Parent.Transparency = 1 local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player then player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 1 script.Sound:Play() script.Parent.Transparency = 1 wait(5) script.Parent.Transparency = 0 db = true end end end end)
seemed like the rest of the script was running even though it didn't check to see if it was an actual player, and maybe make this a server script, and check to see if the script isn't disabled