exp.Changed:Connect(function()
if exp.Value >= required_exp.Value then
exp.Value -= required_exp.Value
level.Value += 1
required_exp.Value = level.Value * 100
Player.Character.Humanoid.MaxHealth += 4
end
end)
For no reason at all this code does not work with large numbers, it has worked perfectly fine with no issues from other methods of getting XP within the game. But when I decided to add a code system that grants 1k XP using a code it suddenly breaks. I've read about this issue in which its due to the value infinitely changing within the function but I absolutely fail to see how it would infinitely loop due to me changing the value up until the exp value is less than the required xp value. it somehow creates xp out of nowhere with my system you should end up at lvl 5 but instead im somehow at lvl 9 even though lvl 5-6 have more xp requirements combined than what is given.

1 comment
I understand this, the point I dont get is within the if statement it will not run if the value is not greater than or equal to the required exp so it wouldnt change again