How do I stop my ragdoll from imploding on itself?

I have no idea how or why but my ragdoll keeps collapsing on itself?
Here’s a video;

I dont think its a character issue since it happens without custom characters as well.
Code:

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(character)
		local humanoid = character:WaitForChild("Humanoid")

		if humanoid then
			humanoid.BreakJointsOnDeath = false
			
			humanoid.Died:Connect(function()
				for i, v in pairs(character:GetDescendants()) do
					if v:IsA("Motor6D") then
						local part0 = v.Part0
						local part1 = v.Part1

						local Attachment1 = Instance.new("Attachment", part0)
						local Attachment2 = Instance.new("Attachment", part1)

						local Socket = Instance.new("BallSocketConstraint")
						Socket.Attachment0 = Attachment1
						Socket.Attachment1 = Attachment2
					
						Socket.LimitsEnabled = true	
						Socket.TwistLimitsEnabled = true
						
						Socket.TwistLowerAngle = -45
						Socket.TwistUpperAngle = 45
						Socket.UpperAngle = 45
					
						Socket.Restitution = 0.1
						
						Socket.Parent = part0


						v:Destroy()
					end
				end
			end)
		end
	end)
end)


How about making a script which changes the players collisiongroup (Basically making the player not collide with itself)

-- Put this script in ServerScriptService

local Players = game:GetService("Players")
local PhysicsService = game:GetService("PhysicsService")
local GroupName = "Players" -- Name this whatever

PhysicsService:RegisterCollisionGroup(GroupName) -- Makes a new CollisionGroup
PhysicsService:CollisionGroupSetCollidable(GroupName, GroupName, false) -- Sets It's attributes so it can't collide with itself

Players.PlayerAdded:Connect(function(Player)
    Player.CharacterAdded:Connect(function(Character)

        local function ChangeGroup(Part)
            if Part:IsA("BasePart") then
                Part.CollisionGroup = GroupName
            end
        end

        Character.ChildAdded:Connect(ChangeGroup)
        for i, Object in Character:GetChildren() do
            ChangeGroup(Object)
        end
    end)
end)

If you find an easier solution please forget I exist :hidere:

Try using the characters attachment instead or replacing the Motor6D’s C0 and C1, if you create a new attachment it will be centered at the center of the part and not at the joints.

Example from otheer ragdoll script using the Motor6D’s C0 and C1: