Disclaimer, yes I did look for posts like this and either they didnt work or are well outdated so they also didnt work.
So, how do I make a ragdoll and unragdoll script?
Disclaimer, yes I did look for posts like this and either they didnt work or are well outdated so they also didnt work.
So, how do I make a ragdoll and unragdoll script?
BallSocketConstraints.
for _, Motor6D in ipairs(Character:GetDescendants()) do
if Motor6D:IsA("Motor6D") then
Motor6D.Enabled = false;
local BallSocket = Instance.new("BallSocketConstraint")
local Attachment1 = Instance.new("Attachment")
local Attachment2 = Instance.new("Attachment")
Attachment1.CFrame = Motor6D.C0
Attachment2.CFrame = Motor6D.C1
Attachment1.Parent = Motor6D.Part0
Attachment2.Parent = Motor6D.Part1
BallSocket.LimitsEnabled = true;
BallSocket.TwistLimitsEnabled = true;
BallSocket.Attachment0 = Attachment1
BallSocket.Attachment1 = Attachment2
BallSocket.Parent = Motor6D.Parent
end
end
I’m sure there are better ways to do this, but thats how I did it.
If you want to “unragdoll” again, you disable the BallSocketConstraints and enable the motor6d’s again
I still use EchoReaper’s ragdoll script to this day. You could use it as well or use it as a basis to create your own if it doesn’t suit your needs.
Ps for those who want It I created a function that will ragdoll a character, it just requires a bool value to see if it should ragdoll or to unragdoll.
local function ragdoll(doRagdoll,Character:Model)
if doRagdoll then
for _, Motor6D in ipairs(Character:GetDescendants()) do
if Motor6D:IsA("Motor6D") then
if not Motor6D:FindFirstChildOfClass('BallSocketConstraint') then
Motor6D.Enabled = false
local BallSocket = Instance.new("BallSocketConstraint")
local Attachment1 = Instance.new("Attachment")
local Attachment2 = Instance.new("Attachment")
Attachment1.CFrame = Motor6D.C0
Attachment2.CFrame = Motor6D.C1
Attachment1.Parent = Motor6D.Part0
Attachment2.Parent = Motor6D.Part1
BallSocket.LimitsEnabled = true;
BallSocket.TwistLimitsEnabled = true;
BallSocket.Attachment0 = Attachment1
BallSocket.Attachment1 = Attachment2
BallSocket.Parent = Motor6D.Parent
else
Motor6D:FindFirstChildOfClass('BallSocketConstraint').Enabled = true
Motor6D.Enabled = false
end
end
end
else
for _, Motor6D in ipairs(Character:GetDescendants()) do
if Motor6D:IsA("Motor6D") then
Motor6D.Enabled = true
if Motor6D:FindFirstChildOfClass('BallSocketConstraint') then
Motor6D:FindFirstChildOfClass('BallSocketConstraint').Enabled = false
end
end
end
end
end
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.