Is there a more efficient way to level up a player than just doing the same line of code over and over and over? EX:
while true do wait(.1) if p:WaitForChild("leaderstats").EXP.Value >= 100 then script.Parent.Level.Text = 10 wait(2) break end end while true do wait(.1) if p:WaitForChild("leaderstats").EXP.Value >= 200 then script.Parent.Level.Text = 11 wait(2) break end end
If you would like to add 100 XP or any amount to get to the next level every time, use this:
while wait(.1) do --saving one line by putting wait here local LevelUpValue = 100 local CurrentLevel = 10 if p:WaitForChild("leaderstats").EXP.Value >= LevelUpValue then script.Parent.Level.Text = CurrentLevel LevelUpValue = LevelUpValue + 100 --add amount of xp you can multiply though CurrentLevel = CurrentLevel + 1 --add level end end
I hope this works for you, because I had to do something like this once and it worked for me.