Background: I'm making a leveling system that once you level up, the exp you needs increases. So for instance. Level 1 = 200 EXP Needed Level 2 = 400 EXP Needed.

I'm also trying to scale this with a GUI. So the GUI's bar would be 0/200 and would increase all the way to end of the bar, and then level up and go back to the beginning.

Question Is there any way to do this? I can only make it where once the EXP reaches the end of the bar, it levels you up, but the EXP needed doesn't increase. If I decided to make the EXP increase, I would have to make the bar longer.

So my theory was to reduce the EXP you get as you level up, but that isn't exact;y a good method.

-- My Method
--EXP Changing function

PlayerExp.Changed:Connect(function()
	EXP.Size = UDim2.new(PlayerExp.Value/EXPNeeded,0,1,0)
	print(EXP)
end)

--Level up function, Inside a ServerScript (RemoteEvent)
if EXP.Size.X.Offset >= EXPNeeded then
	Player.CharacterSave.Level.Value = Player.CharacterSave.Level.Value + 1
	EXP.Size = UDim2.new(0,1,0,1)
	PlayerEXP = (EXP/1.2) -- Reduces EXP as you level
end

3 comments

0

Just store the total amount of exp (which doesn't decrease when you level up), and calculate the total amount needed for a level as level^2 * C, where C is some constant. Therefore, the amount needed for the next level will be C*((currentLevel+1)^2 - currentLevel^2)

0

Or any function that increases more than linearly will work. You could also do exp required = C^level.

0

Thank you that helped alot.