NPC Ragdoll script is not working (BallSocketConstraint)

I’m sure I’ve done something wrong
BallSocketConstraint being not active

My script (Activates when npc dies)

function Ragdoll()
	for i,v in pairs(Char:GetChildren()) do
        --\\ Attribute is attachment name inside part
		if not v:GetAttribute("Ragdoll") then continue end
		if v:IsA("BasePart") == false then continue end
		
		v.CollisionGroup = "Ragdoll"
		local New = Instance.new("BallSocketConstraint")
		New.Attachment0 = v:FindFirstChild(v:GetAttribute("Ragdoll"))
		New.Attachment1 = v:FindFirstChild(v:GetAttribute("Ragdoll"))
		New.Enabled = true
		New.Parent = v
	end
end

Probably because you aren’t disabling the Motor6D joints between the Player’s parts.

So I have to disable them and it should work

Ok now parts are looking like unanchored, so I guess I have to use weld constraints
Ok, I have no idea, since if I use weld constraint it just being in one pose always

Try prints to see if sections of the code are doing what you want them to:

Also see the note below where you are connecting your Attachment0 and Attachment1. You are connecting both of them to the same Attachment. They need to be connected to 2 separate Attachments for the BallSocket to work correctly.

function Ragdoll()
    print("Ragdoll function called")  -- lets you know if the function is actually being called

	for i,v in pairs(Char:GetChildren()) do
        --\\ Attribute is attachment name inside part
		if not v:GetAttribute("Ragdoll") then continue end

        print(v.Name)  -- tells you the items that are being looked at

		if v:IsA("BasePart") == false then continue end
		
		v.CollisionGroup = "Ragdoll"
		local New = Instance.new("BallSocketConstraint")
		New.Attachment0 = v:FindFirstChild(v:GetAttribute("Ragdoll"))
		New.Attachment1 = v:FindFirstChild(v:GetAttribute("Ragdoll"))
-- in the above 2 lines you are attaching both Attachment0 and Attachment1 to the same point. 
		New.Enabled = true
		New.Parent = v
	end
end