I am currently making a new game, and I am making a obby that can get you coins, but my script keeps on spam giving me cash! What did I do wrong?
amnt = 500
function onTouched(part)
local h = part.Parent:findFirstChild("Humanoid")
if (h~=nil) then
local thisplr = game.Players:findFirstChild(h.Parent.Name)
if (thisplr~=nil) then
local stats = thisplr:findFirstChild("leaderstats")
if (stats~=nil) then
local coins = stats:findFirstChild("Coins")
if (coins~=nil) then
coins.Value = coins.Value + amnt
end
end
end
end
end
script.Parent.Touched:connect(onTouched)
Please help me. Thanks!
