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

Im trying to make a curancy raise can anyone help? I want the loop to stop when you have 50000 EXP.

Asked by 7 years ago
Edited 7 years ago

this is my code (it's in a server script)

ammount = 10
timedelay = 5
currencyname = "EXP"

while true do
    wait(timedelay)
    for i,v in pairs(game.Players:GetPlayers()) do
        if v:FindFirstChild("leaderstats") and v then
            v.leaderstats[currencyname].Value = v.leaderstats[currencyname].Value + ammount

        end
    end
end

I need the while loop to stop when you have 50000 EXP

if you know what do do please tell me in the comments

thanks

0
You want it to stop for all player or just that player who has the max xp? User#5423 17 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

Assuming that you want the entire while loop to stop when you have 50 000 EXP, you could better use a different kind of loop, a Repeat Loop.

repeat
--whatever is inside of the loop
until EXP == 50 000
Ad

Answer this question