Hi developers.
Today while i was making a ragdoll script for my game, once it was finished, I ran into a problem. The joints werent breaking and everything was going good until O realized it didnt really ragdoll. They player fell in a rigid position which looked akward, arms nor legs moved. I will leave the script here in case someone detects an error on it, Thank you!
RAGDOLL SCRIPT ON STARTER CHARACTER SCRIPTS
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)