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

Setting Humanoid's Health with :LoadCharacter()? [SOLVED]

Asked by
Sxerks3 65
8 years ago

So, I'm trying to set the humanoid's health so that whenever they die, their health is kept the same. And because it's activated after clicking a textbutton, I'm trying to activate the :LoadCharacter() event. However, its health is reverted back to 100. Below is only a portion. WalkSpeed and JumpPower are fine.

game.Players.PlayerAdded:connect(function(player)
    player.CanLoadCharacterAppearance = false
    player.CharacterAdded:connect(function(char)
        local humanoid = char:FindFirstChild("Humanoid")
        player.PlayerGui.Classes.Main.Class1.MouseButton1Click:connect(function()
            print("Class 1 picked")
            class1 = true
            class2 = false
            class3 = false
            class4 = false
            class5 = false
            class6 = false
            class7 = false
            class8 = false
            class9 = false
            if class1 and class2 == false and class3 == false and class4 == false and class5 == false and class6 == false and class7 == false and class8 == false and class9 == false then
                print("Walkspeed and health altered")
                humanoid.WalkSpeed = 22
                humanoid.MaxHealth = 125
                humanoid.Health = 125
                humanoid.JumpPower = 60
                player:LoadCharacter()
            end
        end)
0
Maybe add a wait() after maxhealth docrobloxman52 407 — 8y
0
Hm, still doesn't work. Sxerks3 65 — 8y
0
So, apparently, a few people have also been complaining about this. Lucky it's not just me. Sxerks3 65 — 8y
0
Derp, had to rearrange some things. Sxerks3 65 — 8y

Answer this question