heres my script
game.Players.PlayerAdded:Connect(function(plr) local stats = Instance.new("IntValue",plr) stats.Name = "leaderstats" local Gold = Instance.new("IntValue",stats) Gold.Name = "Gold" Gold.Value = 0 local XP = Instance.new("IntValue",stats) XP.Name = "XP" XP.Value = 0 local lvl = Instance.new("IntValue",stats) lvl.Name = "lvl" lvl.Value = 0 local xpneeded = 99 + (25 * lvl.Value) XP.Changed:connect(function() if XP.Value > xpneeded then lvl.Value = lvl.Value + 1 XP.Value = 0 end end) end)
here is the working script
game.Players.PlayerAdded:Connect(function(plr) local stats = Instance.new("IntValue",plr) stats.Name = "leaderstats" local Gold = Instance.new("IntValue",stats) Gold.Name = "Gold" Gold.Value = 0 local XP = Instance.new("IntValue",stats) XP.Name = "XP" XP.Value = 0 local lvl = Instance.new("IntValue",stats) lvl.Name = "lvl" lvl.Value = 0 XP.Changed:connect(function() local xpneeded = 99 + (25 * lvl.Value) --- heres where the xpneeded needs to get created if XP.Value > xpneeded then lvl.Value = lvl.Value + 1 XP.Value = 0 end end) end)