Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you make the command run once for each player?

Asked by
xam345 5
7 years ago

I have been trying to make a obby and have run into a problem with stages, when i touch the block and move around the value goes up instead of adding just one (stage one). I appreciate the help!

script.Parent.Touched:connect(function()
    for _,Player in pairs(game.Players:GetPlayers()) do
        if Player:FindFirstChild("leaderstats") then
            Player.leaderstats.Stage.Value = Player.leaderstats.Stage.Value +1
        end
    end
end)

thx

0
You can use a debounce or use a more elaborate method of making sure the player doesn't get another level by adding a string value with the players name, and using an if statement (just my idea though) StoIid 364 — 7y

Answer this question