How to stabilize character after ragdolling?

This script for ragdolling partly works, it’s just that the ragdolled player constantly flies around. Any ideas?

local function ragdollPlayer(Humanoid)
	for _, object in pairs(Humanoid.Parent:GetDescendants()) do
		if object:IsA("Motor6D") then
			local Att0, Att1 = Instance.new("Attachment"), Instance.new("Attachment")
			Att0.CFrame = object.C0
			Att1.CFrame = object.C1
			Att0.Parent = object.Part0
			Att1.Parent = object.Part1
			local BSC = Instance.new("BallSocketConstraint")
			BSC.Attachment0 = Att0
			BSC.Attachment1 = Att1
			BSC.Parent = object.Part0
			object:Destroy()
		end
		if object:IsA("BasePart") then
			object.CanCollide = true
		end
	end
end