Help with a TOGGLEABLE ragdoll system? (dont need an answer anymore)

  1. What do you want to achieve? I’m trying to make a good ragdoll system that can be easily toggled without messing with your health and therefore keep you alive.

  2. What is the issue? I currently have a death-only script that i can somewhat understand, but my problem is that (probably wrong as this is only what i understood) it relies on the motor6D’s permanently deleting when you die and so the ball constraints take over when your limbs are supposed to have popped apart. How can i refine this script so that it makes the characters joints alternate between this motor6D and ball constraint effect without killing them or needing them to be dead? and also any other complications from being alive like disabling being able to stand up while ragdolled

I’m not good enough to make a complete ragdoll system from scratch yet, so I’ve been looking for a ragdoll system that works for me, but i can also understand so i can work on it and generally just get better at scripting. only problem is all ragdoll scripts i’ve found are either death-only, or are really complicated so i cant implement them into what i need and im not learning anything by copy and pasting it into my game.

again, not my code, just the simplest code i found here.

not gonna lie even in this code i dont understand what the desc variable is

local died
		died = model.Humanoid.Died:Connect(function()
			local descendants = model:GetDescendants()
			for i=1,#descendants do
				
				local desc = descendants[i]
				if desc:IsA("Motor6D") then
					local socket = Instance.new("BallSocketConstraint")
					local part0 = desc.Part0
					local joint_name = desc.Name
					local attachment0 = desc.Parent:FindFirstChild(joint_name.."Attachment") or desc.Parent:FindFirstChild(joint_name.."RigAttachment")
					local attachment1 = part0:FindFirstChild(joint_name.."Attachment") or part0:FindFirstChild(joint_name.."RigAttachment")
					if attachment0 and attachment1 then
						socket.Attachment0, socket.Attachment1 = attachment0, attachment1
						socket.Parent = desc.Parent
						desc:Destroy()
					end	
				end
				
			end
		end)