Handling Experience Overflow

I am currentely making a system to handle experience overflow, and figured I’d share the function I’m using as well as explaining how it works.

The Code (Would add comments but variables explain pretty much everything
function xp.Test(Amount, XPNeeded, Level)
	while Amount >= XPNeeded do
		Amount -= XPNeeded
		Amount	= math.round(Amount)
		XPNeeded += XPNeeded / 10
		XPNeeded = math.round(XPNeeded)
		Level += 1
	end	
end

Sorry for the short post, there’s not much to say, just figured someone might want to know :^)

(If you’re really lazy or just hate your players, set the experience after you level up to 0, that will make sure you get no players)

1 Like

This is good, but the code is very messy. It’s eye straining and is hard to read. Can you change it from acronyms to actual words? Example: amt - Amount

1 Like

Oh yeah, sorry I’ve always used that because of general laziness. Although I do see how it could be harder for beginners. Changing now :^)

2 Likes