Put as simply as possible, I’m having trouble figuring out how to update a player’s XP to display as a percent contributed towards their next rank.

Say from rank 1 to rank 2 you go from 0 XP to 400 XP - having 0 XP would be 0%. Having 200 XP would be 50%. I have so far been able to calculate that.

But when the player goes from rank 2 to rank 3, they start at 400 XP and go to 900 XP. How would I make sure that 400 XP is considered 0%? And once they get to rank 3, how do I make sure 900 XP is the new 0%?

One way to do this is to remove it entirely. Here is an example:

local AmountRemovedFromRank = 400 --you would change this as the ranks go up, I am using this example, of rank three, where 400 is the new 0%
local percent = (CurrentXP - AmountRemovedFromRank) / (XPtoNewRank - AmountRemovedFromRank)

Hey @Sorentale
I’m pretty sure you’re somehow storing the xp and the rank in a datastore so you could implement a temporary number value that will always be the rank 1 xp subtracted from the next ranks xp, from that you could calculate the percentage:

local rank1 = 50
local rank2 = 100
local perc = rank2 - rank1

I solved it but it was a little bit different than what you guys suggested. I ended up having to subtract the base XP of the rank from the current xp, then subtracting the base XP of the rank from the rank-up XP.

So the fraction with 500 XP at rank 2 would look like 100/500 instead of 400/900. I know that 100/500 does not equal 400/900 but it’s honestly close enough to achieve my desired effect so I don’t think it’s a huge issue from here. Thanks for helping anyways