If I were to make a level script that when the exp is greater than the Max exp it will go back to 0. Although, i don't like this. Here what I want to happen. Max exp is 1000 and you just got 2000 exp from killing a boss. I want it so that the exp that you got from the boss will subtract from the Max exp. And the remaining exp will be added to exp. If that makes sense. If there is a better way to do this, please tell me. And this is my script on leveling up.
game.Players.PlayerAdded:connect(function(Player)
local Data = Instance.new("IntValue",Player)
Data.Name = "Data"
local XP = Instance.new("IntValue",Data)
XP.Name = "XP"
XP.Value = 0
local Level = Instance.new("IntValue",Data)
Level.Name = "Level"
Level.Value = 1
local Tries = Instance.new("IntValue",Data)
Tries.Value = 10
Tries.Name = "Tries"
local ExCap = Instance.new("IntValue",Data)
ExCap.Value = 500
ExCap.Name = "ExCap"
XP.Changed:connect(function() XPChange(Player,XP,Level,ExCap) end)
end)
function XPChange(Player,XP,Level,ExCap)
if XP.Value >= ExCap.Value then
XP.Value = 0
Level.Value = Level.Value+ 1
ExCap.Value = ExCap.Value * 3
if Level.Value >= 100 then
Level.Value = 100
end
end
end
--script where if the Exp is greater than the Max Exp it will resort to 0.--

1 comment
The parent argument to Instance.new is deprecated and slows down game performance, parent in another line and as the last property