I have a ragdoll on death system… however, i’m wondering how i might be able to temporarily ragdoll a player, and then they get back up? How could I accomplish this?
So something like on SBS?
Where the players can rag doll themselves or the system rag dolls them
Yes… Exactly. But you get back up afterwords
try this i think this has been done before but this is a code i found on researching the forum
local died
died = character.Humanoid.Died:Connect(function()
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)
*This is what @Fm_Trick did and he’s top contributor so it should work
I have decided to update this reply so it’s clearer.
First of all you need to disable the RequiresNeck
property from the Humanoid you want to ragdoll momentarily, this is an important step because otherwise it would die. (Note: This doesn’t have to be done everytime, just do it once and it’ll be fine!)
To accomplish this temporary ragdoll you would set the Humanoid’s state to something like Enum.HumanoidStateType.Physics
and afterwards you would loop through all of the Character’s Motor6Ds and disable them, do this for the Constraints too but instead of disabling you would enable them.
Finally after a set amount of time, you would change the Humanoid’s state to something like Enum.HumanoidStateType.Ragdoll
or any other state you want, then you would enable the Motor6Ds back and disable the Constraints.
Hopefully this is more understandable than before, good luck!
There a lot of ragdoll scripts/modules out there. Check this out
You did not press the code button.
It’s on the topbar when you write something.
This one is pretty epic; you can even preview it in an uncopylocked game
I personally made one of these, however at the moment I don’t have access to my PC, it was also made using OOP.
RAGDOLL.lua (4.5 KB)
Whenever I use this @r0bl0xic808, the humanoid goes launching endlessly in the air. Anyone know how to fix this?
didn’t work lol. character just automatically dies whenever their motor6d’s are changed in any way.
When I did this, the constraints were enabled and then I’d switch every Motor6Ds Part0 to nil (In that order, so the character does not die) though a better way to do this would be to disable the Motor6Ds instead, unchecking the Enabled property.
Another thing you can do is to uncheck the Humanoid’s RequiresNeck property, so it won’t die if the Neck is somehow unattached since that seems to be your problem, my reply was written before RequiresNeck was added as a property.
You’re a life saver. I’ll try to answer back when I test it out myself.
Yep. Works like a charm. Much obliged. You da man
Hey, would you mind explaining what you did differently that now made it work? I’m trying to do what @dcampeon said, but I’m having the same problem that you are, and I don’t know what he means when he says:
More specifically, “in that order, so the character does not die.” That seems like the key change you made but I have no idea what he means by “in that order.” Do what? And in what order? Thanks in advanced if you can help me!
I have updated my initial reply, check it out!
Thank you for your reply! So,
Are you talking about the BallSocketConstraint(s) that I would have to create? If so, I am assuming that you would create the BallSocketConstraints when a character is added and default them to disabled, and then enable them when you want to ragdoll, as well as disable the Motor6D’s. What I’m doing is creating the BallSocketConstraints when a certain event happens, which makes them automatically enabled. Is there any difference between the two methods? This should mean that how I’m doing it should work, as long as I am disabling the Motor6D’s at the same time, correct?
Yes and yes, and there shouldn’t be any difference though I would create them once and keep them disabled until needed.
Change the State from FallingDown to Physics so it doesn’t automatically get set back to another one.
Edit: Don’t disable the HumanoidRootPart’s Motor6D or add constraints to it, leave that untouched otherwise it will throw weird results.