Reviving Humanoid after .Died

Hello.

I am trying to revive the player’s humanoid after it’s state is set to Dead.
This is currently what I’m trying to do:

humanoid.Died:Connect(function()
    humanoid:ChangeState(Enum.HumanoidStateType.None)
    humanoid.Health = 100
end)

However, I can’t seem to able to change the Health after the state is set to Dead.
Is it possible?

Thanks in advance!

2 Likes

I would make the health go to 5 or less. Then set a bool value called dead to true. Then set health to 100. From what I understand once player is dead it’s dead.

2 Likes

I see.
The rest of my code relies on the Died event to be fired.
Isn’t there a way around?

1 Like

Not that I know of. I would just check the values of health the. Change it to 100 as it gets below 5 or less

I did it once with a NumberValue inside the player’s character called FakeHealth.
However, I’m really hoping it’s possible to change this behavior, otherwise I’ll have to change a lot in my current code.

Well tour current function only fires when it dies. So that’s the only real way to do it. You could just check player health without a value and if plr health <= 5 then revive

Sounds like a hacky solution. I don’t really understand why ROBLOX won’t allow changing the Humanoid’s state after dying.
Even using :ChangeState() won’t change it. Apparently it gets locked or something.

Yeah, sorry about that. You just need to check health.

You can probably use :GetPropertyChangedSignal(property) and check if the value is at 5 if you want to rely on Samjay22’s method.

1 Like

Ok!
I’ll leave the thread open to see if someone else can come up with any ideas =)
Thank you, @samjay22.

I said properychanged already didn’t I? Ohh I edited the comment sorry.

I think it is because all the joints break on death…
If the neck and the waist gets destroyed then there is no way to revive the character, And also changing the state to Enum.HumanoidStateType.None after being dead is of no good…

So whenever you need to revive the player :-

  1. First disable the Enum.HumanoidStateType.Dead humanoid state
  2. Then change BreakJointsOnDeath property of the humanoid to false

So try using this…

humanoid:SetStateEnabled(Enum.HumanoidStateType.Dead, false)
humanoid.BreakJointsOnDeath = false

humanoid.Died:Connect(function()
    humanoid:ChangeState(Enum.HumanoidStateType.None)
    humanoid.Health = 100
end)
1 Like

Tried the code above.
No success.
For some reason, when the player dies, it changes the humanoid’s state to Dead, no matter what.
Any other ideas?

I would take a look at this post, they have some good information


Another way to deal with this situation is to save the position the player died and TP them back

So just doing :LoadCharacter(), waiting for the HumanoidRootPart and teleporting to the position?

No, I mean you log the position when the player dies, then load the character

humanoid.Died:Connect(function()
   local pos = humanoid.Parent:FindFirstChild("HumanoidRootPart").Position
   local player = game.Players:GetPlayerFromCharacter(humanoid.Parent)
player:LoadCharacter()
   player.Character:WaitForChild('HumanoidRootPart').CFrame = Cframe.new(pos)
   
   
end)

Written on mobile so there could be some errors, just understand the general point :slight_smile:

Okay!!
Thank you.

Gonna leave this open to see if someone can come up with another solution. I didn’t want to do :LoadCharacter() again. "/

1 Like