Setting humanoid's health to positive nonzero at exactly the same time it was set to 0 negates the death of the humanoid

When a humanoid’s health is set to 0 and at exactly the same time the health is set to a positive nonzero, the humanoid is not put in the dead HumanoidState. This would imply that, with precise timing, deaths of humanoids through 0 health can be negated when the health is set to positive nonzero at that exact moment.

This may depend on the game played, but the default health regeneration script (1% health every second) could result in this as well.

This can be done through different scripts. One script that rapidly heals the humanoid over time will negate the death caused by another script that tries to set the Humanoid’s health to 0.

System information:

  • CPU: Intel(R) Core™ i7-10750H CPU @ 2.60GHz
  • Memory: 16,0 GB
  • GPU 0: Intel(R) UHD Graphics
  • GPU 1: NVIDIA GeForce RTX 2070 with Max-Q Design

Provided is a basic place with the character’s default health script modified to set the health to 0, followed immediately with the default health regeneration (+1% health). The player’s health stays at 1% health.
HealthBug.rbxl (41.6 KB)

Expected behavior

I expect the humanoid to enter the dead HumanoidState once health reaches 0 at any moment. Afterwards, the humanoid’s health can no longer be positive nonzero and the humanoid remains dead.

In this case, the humanoid should remain dead with 0 health, and the healing should not be applied, even if done at the exact same time.

5 Likes

I’ve experienced this a few times before. For example I touch a kill-brick in an obby but avoid dying due to health regeneration happening at the same time that my health is set to zero.

1 Like

If you have a game and don’t want this happening, you can check if the humanoid died, and if not, retry

1 Like

Thanks for the report! We’ll follow up when we have an update for you.

2 Likes

Please! Any updates? My game always suffers from this I’d have to manually change the humanoid state to Dead.
A lot of games who have insta kill and change health to 0 also suffer from this (See: Criminality).

1 Like