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

Changing Humanoid Properties on Death?

Asked by 9 years ago

So I'm trying to make Classes for my game, and I already Made the Gui that when you click it it gives you the tools and changes your health and walkspeed

The problem is

When you die, your humanoid gets reset

So I've tried many things, and right now I have one that is more efficient

I have a BoolValue with the class name (in this case builder) And inside the Boolvalsue I have 2 number Values (Speed and Health)

The script is supposed to fire when the player dies and only if the player's class is Builder. But It doesn't work

Here's the script: (it's a localscript in StarterGui)

player = script.Parent.Parent
Character = player.Character
Humanoid = Character:WaitForChild("Humanoid")


Character:WaitForChild("Humanoid").Died:connect(function()
            if player.Backpack.Builder.Value == true then
                Humanoid.WalkSpeed = player.Backpack.Builder.Speed.Value
                Humanoid.MaxHealth = player.Backpack.Builder.Health.Value
                Humanoid.Health = player.Backpack.Builder.Health.Value
            end
end)

1 answer

Log in to vote
-1
Answered by 9 years ago

Well it won't work because you're changing the values of a dead character, the values reset on death.

Ad

Answer this question