Here is the code
function onXPChanged(player, XP, Level) if XP.Value>=Level.Value * 80 + XP.Value then Level.Value = Level.Value + 1 end end function onXPChanged2(player, XP2, Level2) if XP2.Value>=Level2.Value * 80 + XP2.Value then Level2.Value = Level2.Value + 1 end end function onLevelUp(player, XP, Level) if player.Character~=nil then for i = 1,5 do local fireworks = Instance.new("Part") fireworks.Shape = 0 fireworks.formFactor = "Symmetric" fireworks.Size = Vector3.new(1,1,1) fireworks.BrickColor = BrickColor.Random() fireworks.CFrame = player.Character.Head.CFrame + Vector3.new(0,2,0) fireworks.Parent = game.Workspace game:GetService("Debris"):AddItem(fireworks, 2) fireworks.Velocity = Vector3.new(math.random(-30,30),math.random(-30,30),math.random(-30,30)) end end end function onLevelUp2(player, XP2, Level2) if player.Character~=nil then for i = 1,5 do local fireworks = Instance.new("Part") fireworks.Shape = 0 fireworks.formFactor = "Symmetric" fireworks.Size = Vector3.new(1,1,1) fireworks.BrickColor = BrickColor.Random() fireworks.CFrame = player.Character.Head.CFrame + Vector3.new(0,2,0) fireworks.Parent = game.Workspace game:GetService("Debris"):AddItem(fireworks, 2) fireworks.Velocity = Vector3.new(math.random(-30,30),math.random(-30,30),math.random(-30,30)) end end end function onPlayerRespawned(player) wait(5) --[[ local stuff = player.Backpack:GetChildren() wait(5) for i = 1,#stuff do local name = stuff[i].Name if game.Starterpack:findFirstChild(name)==nil then stuff[i]:Clone().Parent = player.Backpack end end --]] end function onPlayerEntered(newPlayer) local stats = Instance.new("IntValue") stats.Name = "leaderstats" local Level = Instance.new("IntValue") Level.Name = "Crafting_Level" Level.Value = 1 local XP = Instance.new("IntValue") XP.Name = "CFExperience" XP.Value = 0 local Level2 = Instance.new("IntValue") Level2.Name = "Mining_Level" Level2.Value = 1 local XP2 = Instance.new("IntValue") XP2.Name = "MIExperience" XP2.Value = 0 XP.Parent = stats XP2.Parent = stats Level.Parent = stats Level2.Parent = stats stats.Parent = newPlayer XP.Changed:connect(function() onXPChanged(newPlayer, XP, Level) end) Level.Changed:connect(function() onLevelUp(newPlayer, XP, Level) end) XP2.Changed:connect(function() onXPChanged2(newPlayer, XP2, Level2) end) Level2.Changed:connect(function() onLevelUp2(newPlayer, XP2, Level2) end) newPlayer.Changed:connect(function (property) if (property == "Character") then onPlayerRespawned(newPlayer) end end) end game.Players.ChildAdded:connect(onPlayerEntered)
The reason your levels aren't going up is pretty simple:
You told the game that if the XP is greater than or equal to the XP + Level80, then it would level them up.The main thing that's wrong here is that your telling it to go up if a value is larger than itself plus something else, which will clearly never be the case (unless your adding a negative)
To fix this, you simply need to change the functions to this:
function onXPChanged(player, XP, Level) if XP.Value>=Level.Value * 80 then --I took out '+XP.Value' which was causing the problem Level.Value = Level.Value + 1 end end function onXPChanged2(player, XP2, Level2) if XP2.Value>=Level2.Value * 80 then --Same as above ^ Level2.Value = Level2.Value + 1 end end
Anyways, the script should work correctly now. If you have any further problems/questions, please leave a comment below. Hope I helped :P