How to make ragdoll?

I tried to make a ragdoll script, but it just flies the character like a bird.
I tried a lot of stuff to fix it but it is still the same.
Is there a way I could fix this?

Code
Player.Character.Humanoid.WalkSpeed = 0
	for _, v in pairs(Player.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()
		end
	end
Video

robloxapp-20210122-0217202.wmv (271.0 KB)

2 Likes

Destroy the Motor6D with

v:Destroy()

I already do, that is not the issue

set the humanoids PlatformStand to true

Maybe try adding:

b.LimitsEnabled = false
b.TwistLimitsEnabled = false

My bad, didn’t see that line for some reason.
Try the answers above or maybe set the parent to v.Part1?

Also, did you set the humanoidrootpart collision off?

Thank you, I will give it a try.

if that doesnt work maybe try humanoid:ChangeState(“Physics”)

I tried, it didn’t change anything. Thank you though.

One, make sure humanoid doesn’t break joints on death. Second, follow @smuffgahmin code.

I tried doing that, it didn’t work.

Thank you so much, it worked, but for some reasons the arms and legs are going through the ground

thats when u need set state ragdoll and stuff

What do you mean?

(just to make it above the required amount of characters)

theres this Humanoid | Documentation - Roblox Creator Hub
it allows you to set a humanoids state, ChangeState(“Physics”) will make it so limbs have collisions