Character ragdoll system bug

I want to make a ragdoll death system, this is the serverscript ( Event is fired from localscript upon character death ) :

local humanoid = script.Parent.Humanoid
humanoid.BreakJointsOnDeath = false

script.RemoteEvent.OnServerEvent:Connect(function() -- This fires upon death
	
	humanoid.AutoRotate = false
	
	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)

The problem is that when player gets ragdolled, character for some reason somehow jiggles ( Check video)

robloxapp-20231208-1731411 - Trim

What could be the reason of that? Humanoid state is constantly dead cuz humanoid is dead

2 Likes

Have you tried adding NoCollisionConstraints? Typically for R6 ragdolls I will add one between the torso and all the limbs.

1 Like

This is now the changed script:


local humanoid = script.Parent.Humanoid
humanoid.BreakJointsOnDeath = false

script.RemoteEvent.OnServerEvent:Connect(function()
	
	humanoid.AutoRotate = false
	
	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.MaxFrictionTorque = 100
			socket.LimitsEnabled = true
			socket.TwistLimitsEnabled = true
			local ncc = Instance.new("NoCollisionConstraint")
			ncc.Parent =  script.Parent.Torso
			ncc.Part0 = script.Parent.Torso
			ncc.Part1 = joint.Part1
			joint:Destroy()
		end
	end

end)

But unfortunately the bug persists, character still jiggles

Wait you got a deleted limb right there? Maybe thats the issue. Its kinda glitching

Do you mean the korblox leg? It should not , because it’s just a mesh applied to a normal hitbox

I honesty dont rlly know what could cause the issue because it never happened to me

is there a particle or a part that comes out of the body?

Yeah I don’t know then, if you want, here is the ragdoll system I always use:
MakeRagdoll.rbxm (5.6 KB)

function MakeRagdoll(character)
    local torso = character.Torso
	local humanoidRootPart = character.HumanoidRootPart
	local head = character.Head
	local leftArm = character["Left Arm"]
	local rightArm = character["Right Arm"]
	local leftLeg = character["Left Leg"]
	local rightLeg = character["Right Leg"]

	torso.Neck:Destroy()
	torso["Left Shoulder"]:Destroy()
	torso["Right Shoulder"]:Destroy()
	torso["Right Hip"]:Destroy()
	torso["Left Hip"]:Destroy()

	script.Attachments.Neck:Clone().Parent = head
	script.Attachments.LeftArm:Clone().Parent = leftArm
	script.Attachments.RightArm:Clone().Parent = rightArm
	script.Attachments.LeftLeg2:Clone().Parent = leftLeg
	script.Attachments.RightLeg2:Clone().Parent = rightLeg
	script.Attachments.LeftLeg1:Clone().Parent = torso
	script.Attachments.RightLeg1:Clone().Parent = torso

	local neckConstraint = script.Constraint:Clone()
	neckConstraint.Parent = humanoidRootPart
	neckConstraint.Attachment0 = torso.NeckAttachment
	neckConstraint.Attachment1 = head.Neck

	local leftArmConstraint = script.Constraint:Clone()
	leftArmConstraint.Parent = humanoidRootPart
	leftArmConstraint.Attachment0 = torso.LeftCollarAttachment
	leftArmConstraint.Attachment1 = leftArm.LeftArm

	local rightArmConstraint = script.Constraint:Clone()
	rightArmConstraint.Parent = humanoidRootPart
	rightArmConstraint.Attachment0 = torso.RightCollarAttachment
	rightArmConstraint.Attachment1 = rightArm.RightArm

	local rightLegConstraint = script.Constraint:Clone()
	rightLegConstraint.Parent = humanoidRootPart
	rightLegConstraint.Attachment0 = torso.RightLeg1
	rightLegConstraint.Attachment1 = rightLeg.RightLeg2

	local leftLegConstraint = script.Constraint:Clone()
	leftLegConstraint.Parent = humanoidRootPart
	leftLegConstraint.Attachment0 = torso.LeftLeg1
	leftLegConstraint.Attachment1 = leftLeg.LeftLeg2

	local collision1 = script.Collision:Clone()
	collision1.Parent = humanoidRootPart
	collision1.Part0 = humanoidRootPart
	collision1.Part1 = torso

	local collision2 = script.Collision:Clone()
	collision2.Parent = humanoidRootPart
	collision2.Part0 = humanoidRootPart
	collision2.Part1 = head

	local collision3 = script.Collision:Clone()
	collision3.Parent = humanoidRootPart
	collision3.Part0 = humanoidRootPart
	collision3.Part1 = leftArm

	local collision4 = script.Collision:Clone()
	collision4.Parent = humanoidRootPart
	collision4.Part0 = humanoidRootPart
	collision4.Part1 = rightArm

	local collision5 = script.Collision:Clone()
	collision5.Parent = humanoidRootPart
	collision5.Part0 = humanoidRootPart
	collision5.Part1 = leftLeg

	local collision6 = script.Collision:Clone()
	collision6.Parent = humanoidRootPart
	collision6.Part0 = humanoidRootPart
	collision6.Part1 = rightLeg

	leftArm.CanCollide = true
	rightArm.CanCollide = true
	leftLeg.CanCollide = true
	rightLeg.CanCollide = true
end

return MakeRagdoll

You will need to download the file cause the script has stuff it clones but just place the script in ReplicatedStorage or something and call it like this:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local MakeRagdoll = require(ReplicatedStorage.MakeRagdoll)

local character = script.Parent
local humanoid = character.Humanoid
humanoid.BreakJointsOnDeath = false

script.RemoteEvent.OnServerEvent:Connect(function()
    humanoid.AutoRotate = false
    MakeRagdoll(character)
end)