Ive got a script so when you touch it, it adds 1 win to the leaderboard, but when i hit it, it adds multiple ones. How would i only make it add 1?
wins = 1
function onTouched(part)
local humanoid = part.Parent:findFirstChild("Humanoid")
if (humanoid~=nil) then
local thisplr = game.Players:findFirstChild(humanoid.Parent.Name)
if (thisplr~=nil) then
local stats = thisplr:findFirstChild("leaderstats")
if (stats~=nil) then
local score = stats:findFirstChild("Wins")
if (score~=nil) then
score.Value = score.Value + wins
wait(0.1)
script.Parent:Destroy()
end
end
end
end
end
script.Parent.Touched:connect(onTouched)
