I’m a bit confused of how people make ragdoll scripts. What do they do?
The most common solution is swapping out the joints with more loose joints. I know it doesn’t sound super detailed, but the joint that replaces the swapped joint is varied depending on the functionality you expect from your new joint.
I don’t know if it’s still around but Glue joints were the classic way to make ragdolls. I would still prefer you look into the newer joints such as ball sockets if you’re looking into making one.
Ya know I got to say, I was looking into it because I wanted to make a toggle-able ragdoll combat style, and I ended up writing this module; however you may want to mess with it a little on your own who knows.
local Motors = {}
local BaseParts = {}
local module = {}
local PhysicsService = game:GetService("PhysicsService")
PhysicsService:CreateCollisionGroup("Colliders")
PhysicsService:CollisionGroupSetCollidable("Colliders", "Colliders", false)
function module:RagdollCharacter(Character, Enabled)
if not Character or (Character and not (Character:FindFirstChild("Humanoid") and Character:FindFirstChild("HumanoidRootPart"))) then
return nil
end
if Enabled and not Motors[Character] and not BaseParts[Character] then
Motors[Character] = {}
BaseParts[Character] = {}
Character.Humanoid.PlatformStand = true
for i,v in pairs(Character:GetDescendants()) do
if v:IsA("Motor6D") then
local socket = Instance.new("BallSocketConstraint")
local part0 = v.Part0
local part1 = v.Part1
Motors[Character][v] = {Part0 = v.Part0, Socket = socket}
local attachment = Instance.new("Attachment")
attachment.CFrame = v.C0
attachment.Parent = part0
local attachment1 = Instance.new("Attachment")
attachment1.CFrame = v.C1
attachment1.Parent = part1
if attachment and attachment1 then
socket.Attachment0, socket.Attachment1 = attachment, attachment1
socket.Parent = v.Parent
v.Part0 = nil;
end
end
if v:IsA("BasePart") then
local Collider = Instance.new("Part")
Collider.Size = v.Size
Collider.CFrame = v.CFrame
Collider.CanCollide = true
Collider.Anchored = false
Collider.Transparency = 1
local w = Instance.new("Weld")
w.Part0 = v
w.Part1 = Collider
w.C0 = CFrame.new()
w.C1 = w.Part1.CFrame:toObjectSpace(w.Part0.CFrame)
w.Parent = Collider
Collider.Parent = v
PhysicsService:SetPartCollisionGroup(v, "Colliders")
PhysicsService:SetPartCollisionGroup(Collider, "Colliders")
BaseParts[Character][v] = Collider
end
end
elseif not Enabled and Motors[Character] then
Character.Humanoid.PlatformStand = false
Character.HumanoidRootPart.CFrame = CFrame.new(Character.HumanoidRootPart.CFrame.p)
for i,v in pairs(Motors[Character]) do
i.Part0 = v.Part0
v.Socket.Attachment0:Destroy()
v.Socket.Attachment1:Destroy()
v.Socket:Destroy()
end
for i,v in pairs(BaseParts[Character]) do
v:Destroy()
end
Motors[Character] = nil
BaseParts[Character] = nil
end
end
return module
Lmao yeah I didn’t get around to finishing the Joint Constraints, was just giving a start.