game.Players.PlayerAdded:connect(function(Player) ----- When a Player joins a server this function happens local Data = Instance.new("IntValue",Player) ----Makes an IntValue inside Player Data.Name = "Data" -----It's name is Data ([Note]: You could change it to leaderstats if you would like a leaderboard with it.) local XP = Instance.new("IntValue",Data) ----Makes a IntValue inside Data XP.Name = "XP" XP.Value = 0 local Level = Instance.new("IntValue",Data) ------- Makes an IntValue Inside Data Level.Name = "Level" ------- It's name is Level Level.Value = 1 XP.Changed:connect(function() XPChange(Player,XP,Level) end) ---- To change the XP, XPChanged function occours end) function XPChange(Player,XP,Level) ------ XPChanged function if XP.Value >= Level.Value*150 then ----- this function occours happens if the Level's Value is greater or equal to this 150 ([Note]: Change 150 to the max XP) XP.Value = 0 --- Resets the XP Level.Value = Level.Value+ 1 end end
By just making it a global script. There is no reason why it should be local.