How can I do this?

So I found a random ragdoll script and put it in the game so that whenever the player dies they ragdoll, but now I want to make a status effects module and just make the player ragdoll.

What’s the issue with this you may ask? Well, the script breaks all of the player’s joints and when I tried stopping it from destroying the joints, it just made the player stand instead of ragdolling when they die.

local humanoid = script.Parent:WaitForChild("Humanoid")
humanoid.BreakJointsOnDeath = false

humanoid.Died:Connect(function()
	for index, joint in pairs(script.Parent:GetDescendants()) do
		if joint:IsA("Motor6D") then
			local socket = Instance.new("BallSocketConstraint")
			local a1 = Instance.new("Attachment")
			local a2 = Instance.new("Attachment")

			a1.Parent = joint.Part0
			a2.Parent = joint.Part1

			socket.Parent = joint.Parent
			socket.Attachment0 = a1
			socket.Attachment1 = a2

			a1.CFrame = joint.C0
			a2.CFrame = joint.C1

			socket.LimitsEnabled = true
			socket.TwistLimitsEnabled = true
			joint:Destroy()
		end
	end
end)

just disable the join with .Enabled = false then reenable it

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.