Humanoid should provide the developer with a reason when it dies

As a Roblox developer, it is currently prohibitively hard to debug why characters are dying. In my case I have a ragdoll system that randomly kills the player when activated. There is no way for me to understand what exactly is killing them since the engine can kill a humanoid in a half dozen different ways. Further, it’s also possible for humanoid scaling to kill the character.

The .Died event on Humanoids currently passes no parameters. It would be nice if it provided some information about what killed the player.

For example, I would like to know if they died from:

  • Health reaching zero.
  • A critical joint getting broken + which joint it was.
  • A critical part getting destroyed + which part it was.

Being able to see this information would let me debug more precisely what is going wrong.

  • Am I dying because of the ragdoll not enabling all constraints fast enough?
  • Am I dying because I’m missing a constraint attaching a critical body part?
  • Am I dying because of a NoCollide critical body part falling off of the ragdoll and falling into the void?
  • Am I dying because I have another gameplay system interacting incorrectly with my ragdoll state?

Knowing this information would let me fix the problem with my code without so much trial and error, or implement informed workarounds for engine quirks.

17 Likes

I’m currently running into an issue on where my Humanoids tend to die randomly upon on ragdoll (While above health 0) It sometimes won’t even change its State to Dead or even fire Died event which is a huge buggy mess, this’ll help a lot.

1 Like

There’s no reason for a humanoid to die unless a script is acting upon it or the character falls past the minimum destroy height. Just make those scripts set a reason of death in the humanoid using an Attribute or ValueObject.

1 Like

You can use DescendantRemoving to check when a joint is removed from the character. Use ChildRemoved to detect when a part is removed.

Alternatively, you can go through the character and check which joint or body part is missing. Slightly tedious, which is why I recommend using the example above.

Set BreakJointsOnDeath to false (this way we’ll know the joints weren’t broken as a result of death). Use Humanoid.Died to detect when the player is dead. If my first example doesn’t find any missing body parts or joints, then the player must’ve died from reaching 0 health.

Correct me if I’m wrong, but NoCollide body parts shouldn’t fall off the character unless theres a missing joint. Doesn’t this mean you could just check for missing joints?

I agree this would be a nice feature, however there seem to be relatively straightforward ways of getting the results your asking for.

1 Like

It would be something really niche or useless, in my opinion, unless you could add your own death reasons

But a reason as to why this could have is the Neck being gone for even a single frame, unless you untick RequiresNeck on humanoid, having no neck for any amount of time will instantly kill them

1 Like

The API suggestion is simply a suggestion. My only ask is that I have extra debugging information easily accessible that doesn’t require me adding extra scripts for tracking hierarchy activity within characters (super noisy), or turning off gameplay systems (debugging methods mentioned would interact destructively).

I don’t care how it’s accomplished. We have step by step debugging tools for physics now, we should have debugging tools for everything that reasonably needs them. I don’t need this capability outside of Studio.

A simple argument that gets passed in the Died event that returns an EnumItem would be very nice and a solution that doesn’t require much effort to implement

Yes, but no cuz it’s always gonna say health reached zero or part touched. And it would probably base off the take damage function rather than editing the health variable so it wouldn’t work for 50% of games already on Roblox. Plus remote functions already exist.