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

Changing Humanoid Properties on Death?

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

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

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