How do i Make a XP System?

Hello, how do i make a Xp system that after you rank up the extra XP tranfers to the next level

1 Like

There are couple of ways to do it.

One of them is to increase the required XP for each level by 100( which is simple).

If you want to reset their XP after leveling up, just decrease their amount by all of their xp. ( for e.g: if they have 500 xp, when they level up, decrease it to 0 or 400 ( if its for lvl 2 for e.g))

Lets say:

100XP → LVL 2
200XP → LVL 3

Now, lets say you have 200 XP and you are level 1. Once you’ve leveled up, the remaining 100 according to your request,would be part of the next level. To do that , when he levels up,you’ll need to check their xp.

1 Like
local Remainder = 0

if XP_Gained + XP_Current > Level_Requirement then
Remainder  = (XP_Gained + XP_Current) - Level_Requirement
--Remainder is the extra xp you have left over, you can use this value as the new XP_Gained as soon as you run your leveling up functio

What @Valkyrop said is another method like they said, there are multiple ways

1 Like

Thanks! also, How would i make a Max leaderstat value? Because I want a Max player level

There must be a script that adds levels to the players. Check if the level value is smaller or == with the max level, else you won’t give them xp.

1 Like

Well you can code it in wherever you handle level ups. requiring that the player level be below the Max in order for the function to work.

For example…

local MaxLevel = 200
if Level < MaxLevel then
--Do your leveling and experience code here because you have not reached the max lvl yet.

Edit: This is basically what @Halacs2008 just said, they replied while I was still typing to you.

I’ve made a module ages ago (private), I hope you know how to make leaderstats.
And XP system is mentioned in the video as an example.

Sorry for the bandicam watermark! this video was for a friend.

> Getting a good formula

If you want to subtract the XP after leveling up, never set it to 0, I've seen alot of people set exp to 0 instead of subtracting it with the max XP.
if (xp.Value >= maxexp.Value) then -- If xp is greater and equal than max exp then
   xp.Value -= maxexp.Value -- Substracts the XP
   level.Value += 1 -- Adds level
   maxexp.Value += 1000 -- Upto you, you can set how many maxexp is needed.

> Implementing it to studio

easyscript.rbxl (52.6 KB)

Note: This module is discontinued and its not completed.

Thank you!

1 Like