Hi there, I've been trying to get the hang of ragdolls, and was reading up on break joints on death when I found some ball constraint ragdoll code by Fm_Trick on the developer forums, I've altered it in an R15 game and understand how it works, but when I use it in an R6 game, it pops my head off and stops the entire rest of the code from running (you can tell because it doesn't ragdoll, just wont break joints.) the original code by Fm_Trick is here.
local died
died = character.Humanoid.Died:Connect(function()
local d = character:GetDescendants()
for i=1,#d do
local desc = d[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)
Thank you for your time.

3 comments
It might be the neck joint but I can't confirm.
nevermind unless you guys can find a reason
Doesn't return an error either