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

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

Asked by 3 years ago
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?

0
Make sure the MaxHealth is changed first before changing the health. You could do Health = Health + Endurance.Value. ninjabryan43 0 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

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.

Ad

Answer this question