Clean way to prevent characters from falling apart on death

As discussed here and here there’s not a single good way to animate/ragdoll characters on death because their joints break apart. You either have to re-attach the joints (ew), plop in a substitute dummy (bleh), or disable Humanoid’s Dead state with SetStateEnabled (super bleh – I have to re-write the humanoid health system and this doesn’t even work with characters that are exploded). There needs to be a clean way to animate characters on death and ragdoll them.

I’m not sure of a good way to do this due to the nature of joints being uncontrollably destroyed in cases like explosions and other sorts of bugs, but maybe someone can propose an elegant solution to this.

8 Likes

In the case of explosions, I’d suggest dropping DestroyJointRadiusPercent down to 0 and handling joint breaking manually with Explosion.Hit. I don’t know about your case, but I’d prefer for explosions to not be an insta-death, and also not necessarily break the joints of everything, like vehicles, for example, for which I’d rather implement a more custom and gradual damage system. @Davidii and I did this with success in this game, minus the custom vehicle damage part.

If explosions are a sole reason you’re having trouble, consider this.

2 Likes

Explosions aren’t the sole reason. Resetting/dying breaking joints is the primary offender.

Constraints shouldn’t be broken by explosions AFAIK.

Constraints don’t alllow for animation

Right.
Yeah I agree, there definitely should be a Humanoid.BreakJointsOnDeath property.
I know I did manage to make animations work with a death script once, I’ll see if I can find it.

I had already ended up re-attaching the character’s limbs shortly before posting this after exhausting all other options, so if you can’t find it, don’t sweat it.

Personally I do not believe there is a clean way to do this, but there are nicer ways than others. Here is what I would do.

  1. Disable the Died state of the humanoid
  2. Listen to HealthChanged and Changed of the neck joint.
  3. Wait for Health to be 0, the neck joint has no Part0/1 or the neck joint is missing entirely.
  4. Do your on death stuff.
  5. wait(5)
  6. Call LoadCharacter
5 Likes

Add ball joints & attachments to the character on spawn, then Enable the ball joints when the character dies.

IMO this is a really bad workaround because you’re having to rewrite how health and death work across your whole game in multiple scripts as opposed to just recreating joints or cloning the character in a single, abstracted module. But as mentioned in the OP, even though better (IMO) than rewriting death/health, those are also pretty bad as well.

@Polyhex I can’t use constraints to animate characters on death to make them grab their chest or something.

Delete the character, that way it doesn’t break apart

Better than nothing smh

Edit: In all seriousness, can’t you just weld the body parts on death?

1 Like

Sorry to bump this, but this needs to be addressed. There needs to be a property for this, BIG time.

2 Likes

I believe you can just do SetStateEnabled and deactivate the Death state on the humanoid. That’s what I did for my game while morphing/re-rigging R15 players.

1 Like

I’m gonna try that.

Heyyyy look what I found on gametest2 lol.

11 Likes