Clean way to prevent characters from falling apart on death


#1

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.


#2

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.


#3

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


#4

Constraints shouldn’t be broken by explosions AFAIK.


#5

Constraints don’t alllow for animation


#6

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.


#7

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.


#8

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

#9

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


#10

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.


#11

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?


#12

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


#13

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.


#14

I’m gonna try that.


#15

Heyyyy look what I found on gametest2 lol.