How do you make it so that the player's max health is increased each time he levels up? Thanks!
local leaderstats = Instance.new("IntValue")
local lv = Instance.new("IntValue",leaderstats)
local exp = Instance.new("IntValue",leaderstats)
local levelUp = {32, 64, 128, 256, 512, 1024, 2048}
game.Players.PlayerAdded:connect(function(Player)
lv.Name = "Lv"
lv.Value = 1
exp.Name = "EXP"
exp.Value = 0
leaderstats.Parent = Player
leaderstats.Name = "leaderstats"
exp.Changed:connect(function()
if exp.Value >= levelUp[lv.Value]then
exp.Value = exp.Value - levelUp[lv.Value]
lv.Value = lv.Value + 1
Player.Character.Humanoid.MaxHealth = Player.Character.MaxHealth + 100 -- I tried this
end
end)
end)

3 comments
You forgot humanoid on line 17 after the =.
You forgot humanoid on line 17 after the =.
Also, the player's MaxHealth resets to 100 when they die... Find a way to make it so the MaxHealth remains the same after they respawn (hint hint: CharacterAdded())