Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How To Make The Default Max Health The New Maximum On Game Join?

game.Players.PlayerAdded:Connect(function(plr)

    local Endurance = plr:WaitForChild("leaderstats").Endurance

    local Character = plr.Character or plr.CharacterAdded:wait()

    Character.Humanoid.MaxHealth = 100 + Endurance.Value
    Character.Humanoid.Health = 100 + Endurance.Value
    Endurance.Changed:Connect(function()
        local Character = plr.Character or plr.CharacterAdded:wait()

        Character.Humanoid.MaxHealth = 100 + Endurance.Value
    end)
end)

So This Script Does Work Correctly, It Does Scale My Endurance Value With My Health, But Instead On Game Join It Starts With The Old Default Maximum Instead Of The New One, So Then The Players Health Is Really Low, Can Anyone Fix This?

1 comment

0

Make sure the MaxHealth is changed first before changing the health. You could do Health = Health + Endurance.Value.

1 answer

One thing you can do is you can insert a humanoid into starterPlayer, then inside the humanoid go down to MaxHealth, and set it to whatever number you want.

This discussion is preserved as it was. New answers, comments, and votes are closed.