Note: been getting a lot of messages about bugs in this, I am no longer updating it so it may not work.
Hey! So I decided to make my own ragdoll module today, so I thought, why not make it open source?
What’s special about this ragdoll module?
So let me give you a list, this ragdoll module:
• Is easy to use
• Allows a lot of customisation
• Works with both R6 and R15
• Despawn Effects
• Works on NPCs and players
• Room to add your own despawn effects
How do I get it?
You can either download the file or get it as a free model. Both are provided below (The place will not be updated, I recommend taking the free model.):
RAGDOLLEXAMPLE.rbxl (34.1 KB)
Video Example:
How to use it!
When you insert the model into your place, it will be in a folder.
To start, place the “Physics” event into your events folder or into ReplicatedStorage, then go into the settings module and update the location of the event.
Next, place the “Ragdoll” module where ever you like, I recommend ReplicatedStorage. This is what my ReplicatedStorage looks like.
Nearly there!
Now go into a LocalScript and do something like this.
local Event = [EVENT LOCATION HERE]
local Camera = workspace.CurrentCamera
local Player = game:GetService("Players").LocalPlayer
Event.OnClientEvent:Connect(function(model, humanoid, plr, recovered)
if plr == Player and not recovered then
Camera.CameraSubject = model.Head
humanoid:ChangeState("Physics")
elseif plr == Player and recovered then
Camera.CameraSubject = model.Humanoid
humanoid:ChangeState("Ragdoll")
end
end)
There, now we are ready to use the module!
So, the only required argument for the module is the model that you want to ragdoll, everything else is done for you via the settings module. But you can override these settings by adding multiple arguments.
require(game:GetService("ReplicatedStorage").Ragdoll):Activate([MODEL - REQUIRED], [DESPAWN TIME - OPTIONAL], [CONSTRAINT TYPE - OPTIONAL], [CAN DESPAWN - OPTIONAL], [CAN RECOVER - OPTIONAL], [LIMITS ENABLED - OPTIONAL], [DESPAWN TYPE - OPTIONAL])
Example:
require(game:GetService("ReplicatedStorage").Ragdoll):Activate(workspace.Tom_atoes, 5, "BallSocketConstraint", true, "Random")
And boom! Your model will now be ragdolled! The module will check to see if the model is a player, don’t worry! If the model is a player, the player will respawn, unless disabled.
Despawn effects
If you want to change the despawn effect, check out the “Settings” module for the ID / String of the despawn effect you would like to use.
To change the current effect or to override one, use the int / string provided.
Want to make your own despawn effects? No problem. Inside the “DespawnTypes” module, there is a template so you can add your own ones! If you want to share your effects, reply with your function and I’ll add it in!
Limits Enabled
Inside the settings module there is now five new settings. Four of which are related to this.
We are looking at MIN, MAX, RES and LIMITSENABLED.
MIN is the minimum angle that the constraint can get to whilst MAX is the maxium. RES is the Restitution, find out more here.
Disclaimer: These only work with HingeConstraint’s and BallSocketConstraint’s at the moment.
Can Recover
Quick update, you can now enable the CanRecover property so that rig is rebuilt! This will just wait [DESPAWNTIME] until rebuilding it. Don’t like the way it works? No problem! Just run this code whenever you need!
Model.Humanoid:BuildRigFromAttachments()
Model.Humanoid:ChangeState("Ragdoll")
-- // set player camera subject back to humanoid here.
Big disclaimer: This will not work on an R6 rig due to a Roblox bug. Hopefully this is fixed in the future.
Enjoy and have a nice day!
Bug? Contact me on these platforms:
Roblox Messages - Tom_atoes
DevForum Messages - Tom_atoes
Twitter - @_Tom_atoes
Or just reply to this thread.