# EXP System (How to make it carry over to next level?)

Hello!

I humbly ask, how can I make experience carry over to the next level please?
I tried doing a method:

``````Stat.Changed:Connect(function(Value)
if Value >= Stat.Parent.Level.Value * 135 and Stat.Parent.Level.Value <= 100 + (Stat.Parent.Refined.Value * 10) then
Stat.Parent.Level.Value = Stat.Parent.Level.Value + 1
Stat.Value = Stat.Value - (Stat.Parent.Level.Value * 135)
print(Stat.Value)
print(Stat.Parent.Level.Value * 135)
print(Stat.Value - (Stat.Parent.Level.Value * 135))
end
end)
``````

What it printed out was: --The first print is the Stat.Value which is the EXP Value it was set at, im not too sure why it was a negative value though? please can someone help me on how to make the experience carry over to the next level?

Thank you!

Maybe because of here?
On the first line of code, you are doing something like this:

``````a = number
b = another number * 135
where it happens
a - b while b is bigger than a.
``````

I think that is why its printing negative.
I am not best at this, so I may be wrong.

Sorry for the math problem I just got from school and I am tired

I tried your method and switched it around but sometimes it still comes as negatives

Player levels up, make their xp 0. Then you get a negative amount for the xp, how would you fix this? Simple, multiply the xp amount by -1. Then add that value to the 0 xp.
-135 * -1 = 135

1 Like

the spaces in this thing are insane…

``````Stat:GetPropertyChangedSignal("Value"):Connect(function()