Ragdoll script seems to make player hang from the air

I have a ragdoll script, but the player seems to be hanging from the air, and I have no idea why. Any answers would be appreciated, thanks!

		for i,v in pairs(char:GetDescendants()) do
			spawn(function()
				if v:IsA("Motor6D") and v.Parent and table.find(bodylimbs, v.Part1.Name) then
					local Socket = Instance.new("BallSocketConstraint")
					local a1 = Instance.new("Attachment")
					local a2 = Instance.new("Attachment")
					a1.Parent = v.Part0
					a2.Parent = v.Part1
					Socket.Parent = v.Parent
					Socket.Attachment0 = a1
					Socket.Attachment1 = a2
					a1.CFrame = v.C0
					a2.CFrame = v.C1
					Socket.LimitsEnabled = true
					Socket.TwistLimitsEnabled = true
					v:Destroy()
				end
			end)
		end
		char.HumanoidRootPart.Anchored = false

image

1 Like

Weld the HumanoidRootPart to the Torso, and make sure Humanoid.PlatformStanding is true.

1 Like

Still the same result, although I might’ve written it wrong. Here’s my code:

local w = Instance.new('Weld')
		w.Parent = char.Torso
		w.Part0 = char.HumanoidRootPart
		w.Part1 = char.Torso
		
		for i,v in pairs(char:GetDescendants()) do
			spawn(function()
				if v:IsA("Motor6D") and v.Parent and table.find(bodylimbs, v.Part1.Name) then
					local Socket = Instance.new("BallSocketConstraint")
					local a1 = Instance.new("Attachment")
					local a2 = Instance.new("Attachment")
					a1.Parent = v.Part0
					a2.Parent = v.Part1
					Socket.Parent = v.Parent
					Socket.Attachment0 = a1
					Socket.Attachment1 = a2
					a1.CFrame = v.C0
					a2.CFrame = v.C1
					Socket.LimitsEnabled = true
					Socket.TwistLimitsEnabled = true
					v:Destroy()
				end
			end)
		end
		
		char.Humanoid.PlatformStanding = true
		char.HumanoidRootPart.Anchored = false
		
1 Like

Hm. Try changing the Humanoid state to Enum.HumanoidStateType.Physics instead of enabling PlatformStanding.

char.Humanoid:ChangeState(Enum.HumanoidStateType.Physics)
1 Like

Okay, so instead of PlatformingStanding I did PlatformStand, and now it doesn’t hang from the air. Instead the legs just sink into the ground. Do you have any ideas.

1 Like

image

1 Like

Oh yeah, my bad. I used the wrong property name, lol.

You need to create collision parts for each limb, and weld them to their respective limb.

1 Like

Could you demonstrate how I would do this?

1 Like

Loop through the limbs, clone them, and set their size a little smaller than the actual limb (e.g. limb.Size *= 0.8), weld them using WeldConstraints to the respective limb, and parent them inside something where ragdoll cleanup is easy (if you plan on making ragdolls undoable)