How would I create an executable ragdoll system?

Hello, so my system of creating a ragdoll system was basically so when you were at around 10 health, your character is ragdolled. However, possibly after some time, the character can get back up. I have read many articles and videos about ragdolling but they are usually about when the player dies, so it’s not how my system would work. The main problem is how would I create a ragdoll but not dead and how would I make it go back up, kind of like restoring it back to life?

I’ve only done a ragdoll system once but never brought the player back to life, so hmmm… you could always try copying the players parts and have the camera focus on their additional model, then after a few seconds, teleport their player back into the workspace.

Though, I’m not sure if my method would be doable.

1 Like

Hey there Kori, there’s a things you should have on a checklist if you plan to make a ragdoll + knocking system.

  1. Ragdoll System ( I use ballsockets )
  • EDIT: 1.A. A way to disable Motor6Ds expect for ones that would kill the player. i.e “Neck”, and “RootJoint”
  1. A detection of when the player reaches below 10 health
  2. A countdown for when the player gets up
  3. Gripping system ( If needed ) ( if your doing a gripping system, I recommend that you disable player death, via StateEnabled )

Heres the code that I used for creating the ballsockets within the player. When I want the player to ragdoll, I disable all the motor6Ds within the player, except for the ones that would kill the player, vice versa if I wanna revive the player.

6 Likes

Hmm, that would make sense about cloning the character and changing the camera. Not really sure about the camera changing since I have never really manipulated the camera’s position. Thank you for replying though!

Also, if anyone never knew, “executable” meant as in ragdolling when it is commanded to ragdoll.

Ah, thank you for that! What motor6Ds are you talking about that can kill the player?

Generally, the Head, and the HumanoidRootPart motors. In addition, this method is also effective for custom NPCs, as long as you add ball sockets. The ballsockets keep the player in place when the motor6Ds are disabled so they don’t fall through the map, hence killing the player.

Edit: I forgot to mention that you have to disable BreakJointsOnDeath.

1 Like

Would the torso count as a killable motor6D or does it not have one?

I disable the torso, so I would assume no.

Edit: I forgot to mention, disabling player death should be done as soon as the player spawns.

humanoid:SetStateEnabled(Enum.HumanoidStateType.Dead,false)

If you want to kill the player, set it back to true, and then use the :ChangeState() function to set the humanoid to Dead, which kills the player.

1 Like

I’ve tried testing this, but it doesn’t seem to ragdoll. I have a health detector and a disabler. How would you disable Motor6Ds?

I’ve tried doing this:

for i, v in pairs(character:GetDescendants()) do
			if v:IsA("Motor6D") and not v.Name == "Neck" and not v.Name == "RootJoint" then
				v.Enabled = false
			end
		end

The reason why it’s not working is because you have not applied Attachments to the Character’s parts.

--Ragdoll insert
for _, v in pairs(character:GetDescendants()) do
	if v:IsA("Motor6D") then
		local a0,a1 = Instance.new("Attachment"),Instance.new("Attachment")
		a0.CFrame = v.C0
		a1.CFrame = v.C1
		a0.Parent = v.Part0
		a1.Parent = v.Part1
			
		local b = Instance.new("BallSocketConstraint")
		b.Attachment0 = a0
		b.Attachment1 = a1
		b.Parent = v.Part0
					
		v:Destroy() --Destroys Motor6D parts, so you might want to save them instead of destroying them.
	end
end
1 Like

It would make sense for destroying them, but how would I recover Motor6Ds?

Did you create a script that creates a ballsocket constraint connecting the all the limbs, including head to the torso?

I followed a tutorial online that was similar to this but with event listeners. However, it doesn’t work, even though no error shows up.

Code
-- [[ Services ]] --
local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player)	
	player.CharacterAdded:Connect(function(character)
		local playerHumanoid = character:WaitForChild("Humanoid")
		playerHumanoid.Died:Connect(function()
			playerHumanoid.BreakJointsOnDeath = false
			
			for _, v in pairs(character:GetDescendants()) do
				if v:IsA("Motor6D") then
					local attachment0,attachment1 = Instance.new("Attachment"), Instance.new("Attachment")
					attachment0.CFrame = v.C0
					attachment1.CFrame = v.C1
					attachment0.Parent = v.Part0
					attachment1.Parent = v.Part1
					
					local ballConstraint = Instance.new("BallSocketConstraint")
					ballConstraint.Attatchment0 = attachment0
					ballConstraint.Attatchment1 = attachment1
					ballConstraint.Parent = v.Part0
					
					v:Destroy()
				end
			end
			character.HumanoidRootPart.CanCollide = false
		end)
	end)
end)

OP, I am not too sure of how to approach making that kind of system as I am struggling to make a ragdoll myself. However, once you make a successful ragdoll function, you could place it anywhere else and it won’t have to be placed inside of an event when the player dies.

As for bringing the player back to a normal state, maybe you can mess around with player states and force them to stand up again, destroy the ball constraints and re-enable the Motor6D. That’s what I’ve heard around the forum.

Thank you all for replying. Also, yes, I did make a function that creates a ballsocket constraint connecting everything.

1 Like

What part is it that is not working? The Ragdoll, or the Getting up part?

-edit- im honestly having the same problem, and willing to share what i have so far

I have tried this, it works. I just disable the motor6ds, and create ballsocket joints. (I also added a revive system where you get up after a certain amount of time), but everytime the humanoid root part gets teleported, when you ragdoll again, your humanoid root part falls out of position and swings around

Create a Blacklist for the HumanoidRootPart motor

and how would i do that? and what would it do to help?

I think your best bet would be to find one of the R to Ragdoll scripts floating around the forum, and modify it to fire the ragdoll and unragdoll based on your health. You’ll need a script to monitor the health and fire the events. I assume you’d have to have a script regenerating health as well, I don’t know if health goes back up by itself or not.

This one ragdolls and wakes up on a timer:
https://devforum.roblox.com/t/cleanest-r-to-ragdoll-script/969930

This one I think toggles on and off based on R:
https://devforum.roblox.com/t/how-can-i-make-a-r-to-ragdoll-script/942730/3

1 Like

no, I meant there is a problem with my ragdoll, after my rig is teleported, the humanoid root part just goes crazy