How can I identify "player" on XP.Changed function?
local Level = Instance.new("IntValue") Level.Name = "Level" Level.Value = 1 Level.Parent = stats local XP = Instance.new("IntValue") XP.Name = "XP" XP.Value = 0 XP.Parent = stats local XPN = Instance.new("IntValue") XPN.Name = "XPN" XPN.Value = 500 XPN.Parent = stats local Gold = Instance.new("IntValue") Gold.Name = "Gold" Gold.Value = 0 Gold.Parent = stats XP.Changed:connect(function() if player:WaitForChild("XP").Value >= player:WaitForChild("XPN").Value then Level.Value = Level.Value+1 XPN.Value = XPN.Value+500 end end)
end)
I would simply use a player added function:
game.Players.PlayerAdded:connect(function(player) end)