How do ragdoll scripts even work?

Okay so, there are tons of tutorials on this topic that just shove code down your throat, I don’t want to just copy code into my game to make it work. Would someone please properly explain to me how to make a ragdoll, where I can stand back up. Preferably whenever I call an event.

So far from what I know, I cannot delete motor6d’s otherwise I cannot reverse the ragdoll. I need to disable roblox’s default joints (motor6d’s from what I understand), and make custom ball joints to simulate a ragdoll.

The only problem is I don’t know how I would do this effectively or at all.
I would really love if someone could explain to me step by step the process and why the script does certain things, as I only want to learn to become a better developer.

2 Likes

Motor6D’s have a thing called Enabled meaning you can practically simulate the deleting Motor6D’s
Here’s an example place file of what I mean
Ragdoll.rbxl (56.2 KB)

1 Like

For the collision stuff i would make a table of where its going to be welded to, the parents and or offsets and go through that table

2 Likes

How exactly does custom welding work with custom joints?

If you mean you’re using a custom rig with more joints then it would be the same process

Hi,
A common way this is achieved is by temporarily storing the joints elsewhere and replacing them with ball joints and adding collision groups, and then switching back to the stored pre-existing joints upon getting back up. I don’t think it’s a very optimized way to do it, but it’s a great place to start.

In order to do this I would have to destroy the ball joints which kills the player

Not exactly,

Since lua is executed from top to bottom, you can re-instance the pre-existing joints back to their designated places before removing the ball joints

And @AntiNukeYT
Do you have to replace or destroy them? Only the neck joint weld being destroyed kills the player.
Can’t you have both there with the Motor6Ds Enabled and BallSocketConstraints dissabled, then Enable = false the Motor6Ds and Enable = true the BallSocketConstraints?

Oh true didn’t even think of that.

I got one working, ultimately the problem I was having the ENTIRE time was me failing to realize what you cannot change a humanoid state type WITHIN A SERVERSCRIPT. I don’t know why, I still don’t understand why you would not be able to.

The problems I was experiencing was due to how I was using serverscripts and localscripts to use the ragdolls, if anyone else is having trouble I’d recommend seriously thinking about what goes where. Seems pretty basic but when dealing with welding joints and stuff it can be easily overlooked.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.