Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

1 comment

0

You want it to stop for all player or just that player who has the max xp?

1 answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.