-
What do you want to achieve? Keep it simple and clear!
I need to make a ragdoll system for my attacks, so when they hit, it ragdolls the attacked player for a few seconds. -
What is the issue? Include screenshots / videos if possible!
The issue is I’ve seen problems with other R6 ragdolls like the Tom_atoes one -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve looked all around for a working one
2 Likes
Bump because I really need help with this
I think you can find many tutorials about ragdoll. I didn’t try to make one before.
Here is a link to a simple ragdoll system: Humanoid.BreakJointsOnDeath - #13 by Fm_Trick. Ensure you set Humanoid.BreakJointsOnDeath to false.
Not a ragdoll on death system, ragdoll on hit.
It is the same process. Just use the following code for creating joint constraints, and call the function whenever you want the local character to ragdoll:
local function onRagDoll()
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)
2 Likes
Does this also include removing the ragdoll?
You could change desc:Destroy
to desc.Parent = nil
, and then write an inverse function for destroying the joint constraints and setting desc.Parent = d
.
Not sure what you mean, I’m a pretty new scripter, could you explain it a bit more?
1 Like