Ragdoll system: joint spesific ragdolling and more

I seem to have it working, I have a question, would the module work on NPCs? and if it does how would i set it up?

RagdollSystem uses Luau objects to represent the state of the character. The main object is RagdollStructure. If you just want to ragdoll and unragdoll the entire character, the functions in RagdollEaseOfUse should work for NPCs as well. Those functions create a RagdollStructure object for the character if one hasn’t been created for it yet.

However, RagdollEaseOfUse doesn’t have functions for other features such as ragdolling and unragdolling spesific bodyparts or detaching and attaching bodyparts. So if you want to use those features, a RagdollStructure needs to be created with the constructor RagdollStructure.createStructure before you use those features.

With the built-in settings, RagdollStructures are automatically created for player characters when my code considers the character to be fully loaded. The setting that determines whether they should be automatically created is in ragdoll system server settings. For NPCs, you’ll always have to create the RagdollStructure yourself if you want to use the aforementioned features. I recommend creating the RagdollStructure when you spawn the NPC.

One character or one group of connected bodyparts can only have one RagdollStructure. If you try to create a new one when it already has one, an error will be thrown. You can get the existing RagdollStructure by using RagdollStructureCollections.getStructureFromInstance. You can give it the top instance of that character / bodypart group, or any descendant of the top instance.

When you break a joint (using one of the RagdollStructure’s methods for that), the RagdollStructure will be split into two. The original RagdollStructure will represent the parts that are more closely connected to the break hierarchy root bodypart. The new RagdollStructure will represent the other bodyparts. By default, HumanoidRootPart is the break hierarchy root of R6 and R15 characters. For example, if you break the RightShoulder of an R15 character, The BodypartNode objects of RightUpperArm, RightLowerArm and RightHand will be moved to a new RagdollStructure while the BodyPartNodes of the other bodyparts will remain in the original RagdollStructure.

2 Likes

I followed what you said and I have it working, there’s a slight issue though.
I want to remove an NPC’s limb(s) and make it look smooth, but if I give the client network ownership of the NPC, the limbs just phase through the map for some reason.

For whatever reason, when the limb of an R6 character is detached and the server changes the CanCollide to true, Roblox doesn’t seem to replicate the CanCollide change so it’s false on the clients (including the network owner who does the physics simulation). R15 characters don’t have this issue, and in the case of R6, I had missed it in earlier testing because I replicate the player character RagdollStructures (i.e. create and update client copies of the Luau objects) to every client and as a result every client sets the CanCollide to true as well. The issue happened when using a non-replicated RagdollStructure that was network-owned by a player.

I fixed this by adding a new RemoteEvent for telling the clients to which the RagdollStructure is not replicated to change the CanCollide values.

1 Like

Hi, I seem to be receiving this error when I try to load up the EaseOfUse Ragdoll Module, it seems to be that the module is trying to require two other module in ReplicatedStorage that do not exist ("RemoteSystemPackage & “GeneralUtility”), I have searched the folder but I am unable to find these modules, is it possible that you have not included these? Also are you aware of any quick fixes I could apply to make my ragdoll work. Thank you :heart:
image

Although RagdollSystem used to include GeneralUtility and RemoteEventSystem as nested packages, it doesn’t include them anymore. They need to be inserted as siblings of RagdollSystem. The reason why they aren’t included as nested packages anymore is that I don’t want there to be multiple copies of them in the same game if RagdollSystem is not the only thing using them. Now that you asked about this, I added links to the two other packages below the RagdollSystem link so people don’t need to go to my inventory to get them anymore.

1 Like

I have another question, where in the RagdollStructureJointBreakAndMerge module is the variable for the limb? I’m trying to put an attribute called “Dismembered” on it and the client will run a run service loop checking for descendants of workspace with the attribute before setting its cancollide to true, but I cannot seem to find the variable for it.

Edit: I’ve solved my own problem by just using string.match and using loops

Did the fix I made earlier for the CanCollide problem not work for you? Or why do you need to set CanCollide yourself? When implementing the CanCollide fix, I had made a mistake that caused the code to error in a live game. In my testing, it worked fine in studio, though. Also, I have now updated RagdollSystem again with a fix for the error so it should work both in-game and in studio.

Ah, yes it works now. Thank you.

Another question, my game has a death system similar to Deepwoken or Rogue Lineage’s, where if you take fatal damage you won’t die but go unconscious and ragdoll, and another event has to be called on you to die fully. I’ve set up the same system using your ragdoll module, when you get knocked from the fatal damage it’s fine, but when your character fully dies (via the execute event), the ragdoll seems to glitch to its position about half a second ago.
https://cdn.discordapp.com/attachments/1210778938650132541/1246500641401081977/RobloxStudioBeta_PBirjdrfRD.gif?ex=665c9daf&is=665b4c2f&hm=1bb8d75e77028e2a3c1cd57ce8e980bf4dcc4b5f3ea60d640600632a681a8b57&

The link doesn’t seem to work.

Apologies, I think I fixed it myself anyway, I believe it was because when the humanoid.died event was called it would ragdoll the player, but the player was already ragdolled due to the low hp.

Also, new error:


I just went into a two player local playtest, and there were 3 characters for some reason(?) and the console was filled with this error.

Your ragdollCharacterSettings.chooseRigAttachmentOfBodypartWithMotor6DAsRigAttachment1 value was probably different than what I have been using (I’ve used true for R15 and false for R6). RagdollRootConstraint gets its humanoidRootPart and torsoPart references when it’s rig attachment properties are set. createCharClone (a function related to preventing character teleportation due to network delay when ragdolling) used to be called every time either RigAttachment was set. I hadn’t encountered this error before because I had the aforementioned setting set such that the RigAttachment of HumanoidRootPart was always the first RigAttachment to be assigned (my code in RagdollCharacterInitializer first sets RigAttachment0 and then RigAttachment1 right after). In cases where the RigAttachment of the torso part was the first one to be assigned (which I assume to be the case with your settings), the humanoidRootPart field was nil when createCharClone was called, which caused an error.

I now changed the code such that when one of the RigAttachment properties of RagdollRootConstraint is set, createCharClone is only called if humanoidRootPart is defined.

New client sided errors:

Error 1


Error 2

Both of these should be fixed now. I also noticed that the CanCollide fix I made earlier caused a new CanCollide problem (CanCollide being true on the client after spawning when it should be false). That should also be fixed now.

1 Like

Just leaving this here,

any idea?

Apparently packagelinks are now automatically removed from free models for whatever reason. I know that the package update features didn’t work for free models even before, but I used PackageLink.PackageId for checking that the instance with name “GeneralUtility” or “RemoteEventSystem” is actually the correct package and not just an unrelated instance that happens to have the same name.

However, that check is practically unnecessary so I just removed it. If you now add updated versions of RagdollSystem and RemoteEventSystem, they should work.

1 Like

I am getting this error and do not know why, it’s pretty important so I can use this system.


I followed the instructions but I’m not sure what the issue is.
Server script initializing.

Testing function

Could you post a screenshot of the entire stack trace of the error?