This is not a local script so i cant do local player so how would i do this?
The last function is what i need help on Playa is where i need the player to be accesed I've already tried game.Workspace.Player and it says there is no 'Player' in worksapce
game.Players.PlayerAdded:connect(function(player)
stat = Instance.new("IntValue", player)
stat.Name = "leaderstats"
Gold = Instance.new("IntValue", stat)
Gold.Name = "Gold"
Exp = Instance.new("IntValue", stat)
Exp.Name = "XP"
Level = Instance.new("IntValue", stat)
Level.Name = "Level"
Level.Value = 0
xpTotal = 11 * Level.Value
player.leaderstats.XP.Changed:connect(function()
if Exp.Value > 11 * Level.Value then
Level.Value = Level.Value + 1 --add a level
Exp.Value = Exp.Value - xpTotal --If its greater than five carry over
end
if Exp.Value == 10 * Level.Value then
Level.Value = Level.Value + 1 -- add a level
Exp.Value = 0 --if it = 4 then Send exp to zero
end
end)
player.leaderstats.Level.Changed:connect(function()
Playa =
Playa.Humanoid.MaxHealth = Level.Value * 10 + 100
Playa.Humanoid.Health = Playa.Humanoid.MaxHealth
end)
end)

2 comments
This is a bad idea. A model could easily have the same name as a player. Plus, you should only use
WaitForChild()when there is a chance for the object not to exist just yet.findFirstChild().Okay, I see what you mean here. I am going to edit my post so that it doesn't give the answer, just says "Answer edited because it is not valid."