Issues with ragdoll

So, I have a big problem with my ragdoll system to where players fling randomly (not a normal fling, a large fling to where your screen goes white into the null zone, character gets destroyed, etc.) I’m not quite sure what activates it, because sometimes it works and sometimes it doesn’t. Usually whenever a player picks up another player using a weld, it works but sometimes it flings both players. It also activates randomly if you’re just knocked.

I have a few scripts which activate it and stuff, but this is the normal script in serverscriptservice.

local RagdollEvent = game.ReplicatedStorage.RemoteEvents.Ragdoll
local UnRagdollEvent = RagdollEvent.Parent.UnRagdoll

RagdollEvent.OnServerEvent:Connect(function(Player)
	local PlayerFolder = game.ReplicatedStorage.PlayerFolders:WaitForChild(Player.Name)
	for i,v in pairs(Player.Character:GetDescendants()) do
		if v:IsA("Motor6D") and v.Parent.Name ~= "HumanoidRootPart" 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.Enabled = false
		end
	end
	PlayerFolder.Stunned.Value = true
	Player.Character.Humanoid.RequiresNeck = false
	Player.Character.Humanoid:ChangeState(Enum.HumanoidStateType.Physics)
	Player.Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp,false)
end)


UnRagdollEvent.OnServerEvent:Connect(function(Player)
	local PlayerFolder = game.ReplicatedStorage.PlayerFolders:WaitForChild(Player.Name)
	for i,v in pairs(Player.Character:GetDescendants()) do
		if v:IsA("BallSocketConstraint") then
			v.UpperAngle = 0
			v.TwistUpperAngle = 0
			v.TwistLowerAngle = 0
			local Joints = Instance.new("Motor6D",v.Parent)
			Joints.Part0 = v.Attachment0.Parent
			Joints.Part1 = v.Attachment1.Parent
			Joints.C0 = v.Attachment0.CFrame
			Joints.C1 = v.Attachment1.CFrame
			v:Destroy()
		end
	end
	for i,v in pairs(Player.Character:GetDescendants()) do
		if v:IsA("Motor6D") and v.Parent.Name ~= "HumanoidRootPart" then
			v.Enabled = true
		end
	end
	PlayerFolder.Stunned.Value = false
	Player.Character.Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
	Player.Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp,true)
end)

Does anything seem off or something? If it helps, the player has a lot of welds on it at a time during gameplay (there’s a lot of attached things to the character. BUT the ragdoll still flings even if there are no welds.)