R6 Ragdoll [Death & Health Properties]

Hello!

I’m new at this platform and I’m looking up for some methods to “improve” my script. I’d like to know how could I modify my currently script and make it that a ragdoll activates on: DEATH or Character with less than 35 health. I’m also looking for a method that makes the ragdoll “deactivates” when the player has gotten more than 35 health.

The code I’m currently using… only works for when a player dies.

pcall(function()
	local humanoid = script.Parent.Humanoid
	humanoid.BreakJointsOnDeath = false
	humanoid.Died:Connect(function()
		for index,joint in pairs(script.Parent:GetDescendants()) do
			if joint:IsA("Motor6D") then
				local socket = Instance.new("BallSocketConstraint")
				local a1 = Instance.new("Attachment")
				local a2 = Instance.new("Attachment")
				a1.Parent = joint.Part0
				a2.Parent = joint.Part1
				socket.Parent = joint.Parent
				socket.Attachment0 = a1
				socket.Attachment1 = a2
				a1.CFrame = joint.C0
				a2.CFrame = joint.C1
				socket.LimitsEnabled = true
				socket.TwistLimitsEnabled = true
				joint:Destroy()
			end
		end
	end)
end)

If you have any clue about how do I modify the script into what I am looking for, it would be great.

2 Likes

In my opinion you should do the same whenever you want the character to ragdoll and what you need to add if you want for a player to ragdoll on low health just simply do this:

humanoid.HealthChanged:Connect(function()
local health = humanoid.Health
local RagdollHealth = 35
if health < RagdollHealth then
 -- ragdoll stuff here
elseif health > RagdollHealth then
-- unragdoll stuff here
end
end)

and if you want for the character to unragdoll just simply enable every motor6d in the player’s torso.

2 Likes

Ok using PlatformStand it works but, there is an issue.

When the player dies he fully gets ragdolled, just like this photo.
image

But when the player achieves the RagdollHealth, he simply ragdolls but it looks like this
image

Plus, he doesn’t unragdolls
image

I’ve made the changes into the script and it finished like this:

pcall(function()
	local humanoid = script.Parent.Humanoid
	local Torso = script.Parent.Torso
	humanoid.BreakJointsOnDeath = false
	humanoid.HealthChanged:Connect(function()
		local health = humanoid.Health
		local RagdollHealth = 35
		if health < RagdollHealth then
			humanoid.PlatformStand = true
			for index,joint in pairs(script.Parent:GetDescendants()) do
				if joint:IsA("Motor6D") then
					local socket = Instance.new("BallSocketConstraint")
					local a1 = Instance.new("Attachment")
					local a2 = Instance.new("Attachment")
					a1.Parent = joint.Part0
					a2.Parent = joint.Part1
					socket.Parent = joint.Parent
					socket.Attachment0 = a1
					socket.Attachment1 = a2
					a1.CFrame = joint.C0
					a2.CFrame = joint.C1
					socket.LimitsEnabled = true
					socket.TwistLimitsEnabled = true
					joint:Destroy()
					
				end
			end
		elseif health > RagdollHealth then
			humanoid.PlatformStand = false
			for index,joint in pairs(Torso:GetDescendants()) do
				if joint:IsA("Motor6D") then
					joint.Enabled = true
				end
			end
		end

		humanoid.Died:Connect(function()
			humanoid.Jump = true
			for index,joint in pairs(script.Parent:GetDescendants()) do
				if joint:IsA("Motor6D") then
					local socket = Instance.new("BallSocketConstraint")
					local a1 = Instance.new("Attachment")
					local a2 = Instance.new("Attachment")
					a1.Parent = joint.Part0
					a2.Parent = joint.Part1
					socket.Parent = joint.Parent
					socket.Attachment0 = a1
					socket.Attachment1 = a2
					a1.CFrame = joint.C0
					a2.CFrame = joint.C1
					socket.LimitsEnabled = true
					socket.TwistLimitsEnabled = true
					joint:Destroy()
				end
			end
		end)
	end)
end)
1 Like

why not change the humanoid state?

Do you know how could I modify the script using “Humanoid State”?

instead of destroying the joint try making it enabled to false

1 Like

iirc you have to use a localscript to change the HumanoidState and use Humanoid:ChangeState(), and then destroy the joints and replace it with new joints

1 Like

and if you maybe assume its because of the getdescendants then do it like this:

Torso["Neck"].Enabled = true etc.

It seems to be working but another issue appeared, I apologize
image
The ragdoll stopped, and I can move normally but now I look like this.

can you look at the motor6ds and the attachments, ballsockets?
if they are in your character parts(arms, legs, torso, head)
then try destroying them

by motor6ds i mean if they are enabled

I can’t destroy all of the Attachments and Motor6Ds, that would break my whole character. And your suggestion didn’t work as well, it just broke even more the character.
image
I can move around but my character would still be on the floor.

EDIT:

nvm, I just can’t move now.

have you ever played the rake classic edition?

that game has good ragdoll system and for what as far i believe it uses collider parts you could try that method.

Yup, the ragdoll is for a related rake game of mine.

And, I’m not sure how would I use Collider Parts to make an ragdoll, I’m totally new at making ragdolls, and as I said, I’ve searched through this platform trying to make a successfully ragdoll.

ragdolling with collider parts is basically this:

whenever a player ragdolls the joints in the torso are disabled
and the collider parts’s cancollide setting is set to true so the collider part would stop the joints like falling off the map

use attachments and ballsockets and colliderparts i dont know if the rake classic edition uses more than those because i have never exploited or any stuff related with exploits.

and also platformstand is being set to true.

you could try searching for good ragdoll system in the toolbox if you just cannot make one i highly recommend you if you use a free model ragdoll system first of all check if there is any viruses.

I forgot to tell you, but my second way to make a ragdoll, it was getting one ragdoll system from TOOLBOX and “rescript” it, yk? Turns out it didn’t work and the system is all messed up. But i’ll try your method, thanks.

i wish you luck on your “remake of the rake” or whatever rake related game you are trying to do.

wait a minute, you could disable the joints? I thought you could just delete them and change the humanoidstate…