What I'm trying to do is make it so when your xp is over your xp required to level up, you level up. The xp is reset to 0 after leveling up, and the xp required to level up again is also increased, however it is not increasing my level by 1.
wait(3) xp = script:findFirstAncestor("PlayerGui").Parent.leaderstats.Exp.Value xpn = script:findFirstAncestor("PlayerGui").Parent.leaderstats.ExpNeeded.Value level = script:findFirstAncestor("PlayerGui").Parent.leaderstats.Level.Value while wait()do script.Parent.Text = xp .. "/" .. xpn if xp >= xpn then level = level + 1 xpn = xpn * 1.25 xp = 0 end end -- This makes you level up, and your experience needed to level again is increased. --
Those variables at the top are just storing the values of the Exp, ExpNeeded and Level. If you change the variable, you're not actually changing the value of the objects.
Drop the .Value on the variables at the top so you're referencing the objects themselves, then change the value in the loop using the .Value.
Here's what it would look like
wait(3) xp = script:findFirstAncestor("PlayerGui").Parent.leaderstats.Exp xpn = script:findFirstAncestor("PlayerGui").Parent.leaderstats.ExpNeeded level = script:findFirstAncestor("PlayerGui").Parent.leaderstats.Level while wait()do script.Parent.Text = xp.Value .. "/" .. xpn.Value if xp.Value >= xpn.Value then level.Value = level.Value + 1 xpn.Value = xpn.Value * 1.25 xp.Value = 0 end end