Ragdoll Problem

I am working on a game and players who die are supposed to ragdoll but the ragdolls are statue like

they just stand still and I can push them over, sometimes the head gets ragdolled but the rest of the body is still, any help?

Here is my ragdoll script:

local RootLimbData = {
{
[“WeldTo”] = “LowerTorso”,
[“WeldRoot”] = “HumanoidRootPart”,
[“AttachmentName”] = “Root”,
[“NeedsCollider”] = false,
[“UpperAngle”] = 10
},
{
[“WeldTo”] = “UpperTorso”,
[“WeldRoot”] = “LowerTorso”,
[“AttachmentName”] = “Waist”,
[“ColliderOffset”] = CFrame.new(0, 0.001, 0),
[“UpperAngle”] = 0
},
{
[“WeldTo”] = “Head”,
[“WeldRoot”] = “UpperTorso”,
[“AttachmentName”] = “Neck”,
[“ColliderOffset”] = CFrame.new(),
[“UpperAngle”] = 20
},
{
[“WeldTo”] = “LeftUpperLeg”,
[“WeldRoot”] = “LowerTorso”,
[“AttachmentName”] = “LeftHip”,
[“ColliderOffset”] = CFrame.new(0.005, -0.210, -0.3)
},
{
[“WeldTo”] = “RightUpperLeg”,
[“WeldRoot”] = “LowerTorso”,
[“AttachmentName”] = “RightHip”,
[“ColliderOffset”] = CFrame.new(0.005, -0.210, -0.3)
},
{
[“WeldTo”] = “RightLowerLeg”,
[“WeldRoot”] = “RightUpperLeg”,
[“AttachmentName”] = “RightKnee”,
[“ColliderOffset”] = CFrame.new(0.005, -0.210, -0.3)
},
{
[“WeldTo”] = “LeftLowerLeg”,
[“WeldRoot”] = “LeftUpperLeg”,
[“AttachmentName”] = “LeftKnee”,
[“ColliderOffset”] = CFrame.new(0.005, -0.210, -0.3)
},
{
[“WeldTo”] = “RightUpperArm”,
[“WeldRoot”] = “UpperTorso”,
[“AttachmentName”] = “RightShoulder”,
[“ColliderOffset”] = CFrame.new(0, 0.4, 0.1),
},
{
[“WeldTo”] = “LeftUpperArm”,
[“WeldRoot”] = “UpperTorso”,
[“AttachmentName”] = “LeftShoulder”,
[“ColliderOffset”] = CFrame.new(0, 0.4, 0.1),
},
{
[“WeldTo”] = “LeftLowerArm”,
[“WeldRoot”] = “LeftUpperArm”,
[“AttachmentName”] = “LeftElbow”,
[“ColliderOffset”] = CFrame.new(0, 0.350, 0.3),
[“UpperAngle”] = 10
},
{
[“WeldTo”] = “RightLowerArm”,
[“WeldRoot”] = “RightUpperArm”,
[“AttachmentName”] = “RightElbow”,
[“ColliderOffset”] = CFrame.new(0, 0.350, 0.3),
[“UpperAngle”] = 10
},
{
[“WeldTo”] = “RightHand”,
[“WeldRoot”] = “RightLowerArm”,
[“AttachmentName”] = “RightWrist”,
[“ColliderOffset”] = CFrame.new(0, 0.125, 0),
[“UpperAngle”] = 0
},
{
[“WeldTo”] = “LeftHand”,
[“WeldRoot”] = “LeftLowerArm”,
[“AttachmentName”] = “LeftWrist”,
[“ColliderOffset”] = CFrame.new(0, 0.125, 0),
[“UpperAngle”] = 0
},
{
[“WeldTo”] = “LeftFoot”,
[“WeldRoot”] = “LeftLowerLeg”,
[“AttachmentName”] = “LeftAnkle”,
[“NeedsCollider”] = false,
[“UpperAngle”] = 0
},
{
[“WeldTo”] = “RightFoot”,
[“WeldRoot”] = “RightLowerLeg”,
[“AttachmentName”] = “RightAnkle”,
[“NeedsCollider”] = false,
[“UpperAngle”] = 0
},
}

function RagdollV2(char, hide_name)

local hdv = char:FindFirstChild("Head")

--set up the ragdoll
local function scan(ch)
	for i = 1, #ch do
		scan(ch[i]:GetChildren())
		if ch[i]:IsA("ForceField") or ch[i]:IsA("Motor6D") or (ch[i].Name == "HumanoidRootPart") or (ch[i]:IsA("Weld") and ch[i].Name ~= "HeadWeld" and ch[i].Name ~= "RadioWeld" and ch[i].Name ~= "AccessoryWeld") then
			ch[i]:destroy()
		end
	end

end

scan(char:GetChildren())

local fhum = Instance.new("Humanoid")
fhum.RigType = Enum.HumanoidRigType.R15
fhum.Parent = char
fhum.Sit = true
if hide_name then
fhum.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
end

local Torso = char:FindFirstChild("UpperTorso")

for i=1,#RootLimbData do
	local limbData = RootLimbData[i];
	local partName = limbData["WeldTo"];
	local weldName = limbData["WeldRoot"];
	local PartTo = char:FindFirstChild(partName);
	local WeldTo =char:FindFirstChild(weldName);

	if ( PartTo ~= nil and WeldTo ~= nil ) then
		if ( char ~= nil ) then

			local scale = 20;
			local vecX = (math.random()-math.random())*scale;
			local vecY = (math.random()-math.random())*scale;
			local vecZ = (math.random()-math.random())*scale;
			PartTo.Velocity = PartTo.Velocity + Vector3.new(vecX, vecY, vecZ);


		end
		-- Create New Constraint
		local UpperAngle = limbData["UpperAngle"]
		local Joint = Instance.new("BallSocketConstraint")
		if ( (UpperAngle ~= nil and UpperAngle == 0) ) then
			Joint = Instance.new("HingeConstraint")
			Joint.UpperAngle = 0
			Joint.LowerAngle = 0
		end
		Joint.Name = limbData["AttachmentName"]
		Joint.LimitsEnabled = true
		Joint.UpperAngle = 30
		Joint.Attachment0 = PartTo:FindFirstChild(Joint.Name .. "RigAttachment")
		Joint.Attachment1 = WeldTo:FindFirstChild(Joint.Name .. "RigAttachment")
		Joint.Parent = PartTo

		if ( UpperAngle ~= nil ) then
			Joint.UpperAngle = UpperAngle
		end

		-- Destroy the motor attaching it


		-- Create Collider
		local needsCollider = limbData["NeedsCollider"]
		if ( needsCollider == nil ) then
			needsCollider = true
		end
		if ( needsCollider ) then
			local B = Instance.new("Part")
			B.CanCollide = true
			B.TopSurface = 0
			B.BottomSurface = 0
			B.formFactor = "Symmetric"
			B.Size = Vector3.new(0.7, 0.7, 0.7)
			B.Transparency = 1
			B.BrickColor = BrickColor.Red()
			B.Parent = char
			local W = Instance.new("Weld")
			W.Part0 = PartTo
			W.Part1 = B
			W.C0 = limbData["ColliderOffset"]
			W.Parent = PartTo

		end
	end
end




spawn(function()

while wait() do
for _,i in pairs(char:GetDescendants()) do
	if i:IsA("Motor6D") then
	i:Destroy()
	end
		end
		end


end)

Hey, just a question is this still open? I might be able to help.

yes this post is still open, do you think you can help me?

So you tryna do ragdoll on death or r to ragdoll?

Make sure you disable all the characters motor6Ds because that can usually cause this.

I would highly reccomend making a simpler ragdoll system that has the characters humanoid BreakJointsOnDeath off.

It will be worth it. way less glitchy and you’ll have more control over it aswell like being able to easily rig more models. And it’s not that hard to make.

All you would have to do is rig up the characters model with the proper constraints before hand then go through their body parts and disable the motor6Ds and turn humanoid.PlatformStand true.
(For collision you will have to either use collision groups or make new “hitboxes” in the exact same shape/size of that part/slightly smaller.)

nah ima help him make a new script no need

Make a script in serverscriptservice name it what ever and type

game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
script.RagdollClient:Clone().Parent = character

	character:WaitForChild("Humanoid").Died:connect(function()
		character.UpperTorso:SetNetworkOwner(player)
	end)
end)

end)

then add a local script inside that script. then type (Make sure you name the local script RagdollClient

local character = script.Parent

function recurse(root,callback,i)
i= i or 0
for _,v in pairs(root:GetChildren()) do
i = i + 1
callback(i,v)

	if #v:GetChildren() > 0 then
		i = recurse(v,callback,i)
	end
end

return i

end

function ragdollJoint(part0, part1, attachmentName, className, properties)
attachmentName = attachmentName…“RigAttachment”
local constraint = Instance.new(className…“Constraint”)
constraint.Attachment0 = part0:FindFirstChild(attachmentName)
constraint.Attachment1 = part1:FindFirstChild(attachmentName)
constraint.Name = “RagdollConstraint”…part1.Name

for _,propertyData in next,properties or {} do
	constraint[propertyData[1]] = propertyData[2]
end

constraint.Parent = character

end

function getAttachment0(attachmentName)
for _,child in next,character:GetChildren() do
local attachment = child:FindFirstChild(attachmentName)
if attachment then
return attachment
end
end
end

character:WaitForChild(“Humanoid”).Died:connect(function()
local camera = workspace.CurrentCamera
if camera.CameraSubject == character.Humanoid then–If developer isn’t controlling camera
camera.CameraSubject = character.UpperTorso
end

--Make it so ragdoll can't collide with invisible HRP, but don't let HRP fall through map and be destroyed in process	
character.HumanoidRootPart.Anchored = true
character.HumanoidRootPart.CanCollide = false

--Helps to fix constraint spasms
recurse(character, function(_,v)
	if v:IsA("Attachment") then
		v.Axis = Vector3.new(0, 1, 0)
		v.SecondaryAxis = Vector3.new(0, 0, 1)
		v.Rotation = Vector3.new(0, 0, 0)
	end
end)

--Re-attach hats
for _,child in next,character:GetChildren() do
	if child:IsA("Accoutrement") then
		--Loop through all parts instead of only checking for one to be forwards-compatible in the event
		--ROBLOX implements multi-part accessories
		for _,part in next,child:GetChildren() do
			if part:IsA("BasePart") then
				local attachment1 = part:FindFirstChildOfClass("Attachment")
				local attachment0 = getAttachment0(attachment1.Name)
				if attachment0 and attachment1 then
					--Shouldn't use constraints for this, but have to because of a ROBLOX idiosyncrasy where
					--joints connecting a character are perpetually deleted while the character is dead
					local constraint = Instance.new("HingeConstraint")
					constraint.Attachment0 = attachment0
					constraint.Attachment1 = attachment1
					constraint.LimitsEnabled = true
					constraint.UpperAngle = 0 --Simulate weld by making it difficult for constraint to move
					constraint.LowerAngle = 0
					constraint.Parent = character
				end
			end
		end
	end
end

ragdollJoint(character.LowerTorso, character.UpperTorso, "Waist", "BallSocket", {
	{"LimitsEnabled",true};
	{"UpperAngle",5};
})
ragdollJoint(character.UpperTorso, character.Head, "Neck", "BallSocket", {
	{"LimitsEnabled",true};
	{"UpperAngle",15};
})

local handProperties = {
	{"LimitsEnabled", true};
	{"UpperAngle",0};
	{"LowerAngle",0};
}
ragdollJoint(character.LeftLowerArm, character.LeftHand, "LeftWrist", "Hinge", handProperties)
ragdollJoint(character.RightLowerArm, character.RightHand, "RightWrist", "Hinge", handProperties)

local shinProperties = {
	{"LimitsEnabled", true};
	{"UpperAngle", 0};
	{"LowerAngle", -75};
}
ragdollJoint(character.LeftUpperLeg, character.LeftLowerLeg, "LeftKnee", "Hinge", shinProperties)
ragdollJoint(character.RightUpperLeg, character.RightLowerLeg, "RightKnee", "Hinge", shinProperties)

local footProperties = {
	{"LimitsEnabled", true};
	{"UpperAngle", 15};
	{"LowerAngle", -45};
}
ragdollJoint(character.LeftLowerLeg, character.LeftFoot, "LeftAnkle", "Hinge", footProperties)
ragdollJoint(character.RightLowerLeg, character.RightFoot, "RightAnkle", "Hinge", footProperties)

--TODO fix ability for socket to turn backwards whenn ConeConstraints are shipped
ragdollJoint(character.UpperTorso, character.LeftUpperArm, "LeftShoulder", "BallSocket")
ragdollJoint(character.LeftUpperArm, character.LeftLowerArm, "LeftElbow", "BallSocket")
ragdollJoint(character.UpperTorso, character.RightUpperArm, "RightShoulder", "BallSocket")
ragdollJoint(character.RightUpperArm, character.RightLowerArm, "RightElbow", "BallSocket")
ragdollJoint(character.LowerTorso, character.LeftUpperLeg, "LeftHip", "BallSocket")
ragdollJoint(character.LowerTorso, character.RightUpperLeg, "RightHip", "BallSocket")

end)

sorry for not responding for a while as I moved away from this, but I was trying to create Persistent Ragdolls, thats just echo reaper’s old ragdoll script, thanks for the help anyway!