Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How does one efficiently achieve a levelling system?

Usually, all my games have XP, but I never used a levelling system as I do not know where to start entirely. For example, would I have to create table which holds all the milestones of XP that a player must reach in order to reach a certain level? Or would I have to do a series of IF statements for example:

if XP > 500 and XP < 999 then
	level = 2
elseif XP > 100 and XP < 1999 then
	level = 3
end

and so on...

4 comments

0

use a simple pattern ex; if XP.Value >= 100 * rank.Value then

0

so if the player's "rank" was 3, they'd need to get 300 XP to level up, since 100 * 3 = 300

0

What if the pattern varies with level? for example, 500xp for level 2, 1000 xp for level 2, 3000 xp for level 3 and so on

0

level = xp/1000

1 answer

✓ Accepted answer

For your question about varying pattern I use something like this:

local constant = someNumber --for my test case this was 100
local modifier = someNumber --for my test case this was 10
local experienceRequiredForNextLevel = constant + currentLevel*modifier

This is by far not the only way to do something like this, for example you could make a quadratic experience function where you have currentLevel^2 + constant, but the above is what I use most often with differing numbers for the constant and modifier depending on the game.

2 comments

0

I had a similar idea but this just clarified it, thank you!

0

Glad I could help!

This discussion is preserved as it was. New answers, comments, and votes are closed.