Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

health system wont work can i have help?

Asked by 3 years ago
Edited 3 years ago

I want to make a health system that goes up by 50 every time you level up how would I do this?

game.Players.PlayerAdded:Connect(function(player)
script.Parent.Humanoid.MaxHealth = 50 * player:WaitForChild('Stats').Level.Value  -- this is max health
    script.Parent.Humanoid.Health = 10 * player:WaitForChild('Stats').Level.Value

1 answer

Log in to vote
0
Answered by 3 years ago

Maybe try getting the old level, and using something in the lines of:

oldLevel = level

level.Changed:Connect(function()
    if oldLevel < level then
        humanoid.MaxHealth = humanoid.MaxHealth + 50
    end
end)

Do something like this to check if the old level was lower than the new one, and if so it will add 50 MaxHealth to the humanoid.

I hope this is what you were looking for!

0
nah didnt work :/ wyatt447 16 — 3y
Ad

Answer this question