Humanoid States

Hey I am in need of help with Humanoid states.
Once my player dies, I have changed the state to:

game.workspace.ScottFaber.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Dead, false) 

Now, say another player wants to heal the humanoid. How do I change the state so it can run again? I have tried a few ways. But I couldnt figure it out.

Here is what happens:
https://gyazo.com/5c0e0ba4f7239eef74aa8524d6b9951c

Thank you, ScottFaber

You should use Humanoid:SetState(state), where state is the Enum HumanoidStateType and can be RagDoll or FallingDown

1 Like

Apparently, there is no Humanoid:SetState() I just tried it.

1 Like

My bad, it’s :ChangeState, not :SetState

1 Like

Thanks.
But it still doesnt allow it to come back from being dead. Like to allow it to regen health and walk around.

1 Like

If you want the health to go up, why not alter the Health property of the humanoid instead?

1 Like

I meant. Once the player dies I am going to make them be able to get looted. And revived.

So once revived I want the health to go back up. However if the humanoid is dead and that isnt set to false. The health wont go back up.

The problem is I cant get it to allow the humanoid to do walk around and do the normal stuff.

1 Like

yeah you can’t revive a player from death. once that HumanoidStateType.Dead is reached, there’s no coming back. to achieve what you want i can think of two ways to do it:

  1. clamp the player’s health. make a function that checks if the player’s health is about to reach 0 or under, then connect that function to the HealthChanged event of the humanoid. done right, this will prevent the humanoid from dying. you can script the rest for disabling the player/activating ragdoll/stopping regeneration when the health falls under a certain threshold.

  2. have a fake health bar. instead of using the :TakeDamage function of the humanoid, make your own custom function that affects your own custom health system. then when the player takes enough damage, you’ll handle all the effects based on the fake health.

1 Like

You could use Player:LoadCharacter to respawn the player, moving the character immediately to the location it died at. Though I haven’t tested this, so I’m not sure if it’ll be completely seamless.

3 Likes

In the end, I made a custom health value. And used that to detect death and added a custom death animation and respawn function.

Thank you to all those whom tried to help me.

1 Like