You should use Array, to contain data of levels scope.
Then, you need variable, to get data from array (CurrentLevel)
Formula of changing bar's (healthbar, manabar, expbar...) size is very simple:
Width of your bar / Value you want to reach * Current Value
So,
Then, if value of your CurrentExp is greater or equal to scope, you need to make a little check:
For example:
Array:
x1 = 240
x2 = 580
CurrentLevel = 1 (So the scope is 240)
CurrentExp = 260
It will:
- check if CurrentExp > Array.at(CurrentLevel) (260 > 240)
- set CurrentExp to CurrentExp - Attay.at(CurrentLevel) (260 - 240 = 20)
- add 1 to CurrentLevel
You will get level 2 and 20 exp with it
I hope I have explained completely enough