I’m trying to make a ragdoll dummy. I have a script that replaces the motor 6Ds in the dummy with ball sockets to make it ragdoll.
Here is the script:
local dummy = script.Parent
dummy.Humanoid.Health = 0
dummy.Humanoid.MaxHealth = 0
local d = dummy: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
-- credit to Fm_Trick for part of script
When I run the script the ragdoll dummy just starts floating up like it’s going to heaven or something.
local dummy = script.Parent
dummy.Humanoid.Health = 0
dummy.Humanoid.MaxHealth = 0
dummy.Humanoid.HumanoidStateType = Enum.HumanoidStateType.Dead
local d = dummy: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
dummy.Humanoid:ChangeState(Enum.HumanoidStateType.PlatformStanding)
Set the dummy’s humanoid state type to dead (when it is dead).