I don't know why this script didn't work.
LocalScript location StarterPlayer/StarterCharacterScript
local Lvl = game.Players.LocalPlayer:FindFirstChild("Level") --I try to use "Lvl" but this didn't work too. local Char = script.Parent local humanoid = Char:WaitForChild"Humanoid" if Lvl.Value == Lvl.Value +1 then humanoid.MaxHealth.Value = humanoid.MaxHealth.Value *1.1 humanoid.Health.Value = humanoid.MaxHealth.Value print("Test") end
I try to find "Level" from leaderstats. I want to after geting lvl to change MaxHealth
Edit: You need to leave away the ".Value" at "Health" and "MaxHealth" (see comment)
local stats = game.Players.LocalPlayer:WaitForChild("leaderstats") local Lvl = stats:FindFirstChild("Level") local oldLvl = Lvl.Value --We will store the current level in a variable local Char = script.Parent local humanoid = Char:WaitForChild("Humanoid") while true do --You probably want this permanent loop to constantly keep checking if the player levelled up. if oldLvl == Lvl.Value - 1 then --If the old level is the same as the new level - 1 (if the player levelled up, ) then continue oldLvl = Lvl.Value --Change the old level to the current level to start the cycle again humanoid.MaxHealth = humanoid.MaxHealth * 1.1 humanoid.Health = humanoid.MaxHealth print("Test") end wait() end
If there are any errors, I will be happy to help! :)