Ragdoll Module - Easy to use ragdoll module for player / NPC deaths

A very simple yet easy to use physics based ragdoll module.

Get the Module from the Creator Store: https://create.roblox.com/store/asset/98146045328032

Here’s a list containing all the changelogs in this post.
v1.1
v1.1.1
v.1.1.2
v1.2
v1.2.1

You’re free to give feedback and submit bugs you encountered. (That would be pretty helpful)

Showcase

Features

  • Creates a corpse (ragdoll) of a character / NPC.
  • Can be required from client and server.
  • Allows you to change the physical properties of the ragdoll.
  • Allows you to set a period of time to delete the ragdoll automatically.
  • Comes with a fading effect that can be disabled anytime.
  • Ragdoll can be called anytime after it’s created. It’s not instant.
  • After it’s called, it can auto-destroy itself.
  • Autofill included!
  • Auto-updates thanks to the package link.
  • Supports any rig that uses Motor6Ds!
  • Can be used in 2 modes; as trigger (makes your character ragdoll and can be disabled back) or as corpse (recommended for one use only ragdolls)
  • Stores ragdoll objects on the module to be accessed by other scripts
  • And more!

Usage Example

local Ragdoll = require(path.to.Ragdoll)
local Player = game.Players.LocalPlayer

Player.CharacterAdded:Connect(function(Character)
	local Humanoid = Character:FindFirstChildOfClass("Humanoid")
	if Humanoid then
		local CharRagdoll = Ragdoll.new(Character, {
			RemovalTime = 10,
			CollisionsEnabled = true,
			Player = Player
			RagdollType = "DeathBody"
		})
		Humanoid.Died:Once(function()
			CharRagdoll:doRagdoll()
		end)
	end
end)

Documentation

new(Character:Model, RemovalTime:number, CollisionsEnabled:boolean, Player:Player):Ragdoll

Creates a new Ragdoll handler.

Ragdoll:doRagdoll(toggle:boolean):boolean

Starts the ragdoll simulation and removes it after the time specified.

:warning: toggle only works if the Ragdoll.RagdollType is "Toggle".

clearAll()

Forcefully removes the active ragdolls from the workspace.

Character:Model

The source character for the ragdoll.

RemovalTime:number

The time in seconds until the ragdoll is removed once created.

CollisionsEnabled:boolean

Whenever the ragdoll will have collisions enabled with the world (Default CollisionGroup)

DoFadeOnRemovalReached:boolean

Whenever the fade effect will be ran when RemovalTime is reached.

FadeTime:number

How much the fade effect will last before removing the ragdoll.

Friction:number

The friction of the ragdoll.

Elasticity:number

The elasticity / bounciness of the ragdoll.

Density:number

The density of the ragdoll.

Player:Player?

The owner of the ragdoll’s source Character. Allows the player to take ownership of the physics in the ragdoll if the module is ran on the server.

AutoDestroy:boolean

Whenever the ragdoll object will be destroyed after Ragdoll:doRagdoll() is finished.

Ragdoll:setRagdollType(Type:RagdollType):boolean

Sets the Ragdoll type to either one of the options; “DeathBody” or “Toggle”.

RagdollType:RagdollType

The Ragdoll’s Type (DeathBody / Toggle)

DebugMode:boolean

shows nerdy stuff (and hitboxes)

TwistAngleRange:number

Maximum twist angle range for the ragdoll’s joints.
360 would be a full joint rotation.

Ragdoll:destroy()

Destroys the ragdoll object.

Ragdoll:isRagdolling():boolean

Checks if the ragdoll is currently activated.

getRagdoll(id:string):Ragdoll|false

Gets the ragdoll object if registered.

17 Likes

Updated to v1.1! (beta, bugs might arise)

  • Now you can ragdoll characters without destroying them.
  • Fixed AutoDestroy cleanup to make it actually cleanup
  • Fixed a typo in cloneModel
  • Added Types.RagdollType
  • Added Types.RagdolCache
  • Added the “Ragdoll:setRagdollType()” method
  • Added “_ragdollCache” table to save joints and reuse them.

Also Fixed the Creator Store link, now it will contain the package.

1 Like

Updated to v1.1.1:

(fix to v1.1, i didn’t have time to test v1.1 before releasing :skull:)

  • Fixed error that caused :doRagdoll to fail.
  • Fixed physics collisions for rig compatibility.
  • Fixed Network Owner Management.
  • Fixed _ragdollCache management.
2 Likes

v1.1.2:

  • Fixed ragdolls with DeathBody Type.
  • Fixed the constraint joining method.
  • Fixed and restructured code in :doRagdoll().
  • Made ragdoll collision hitboxes a bit smaller
  • Added debug mode
1 Like

Updated post to add live showcase of the module.

1 Like

v1.2

> Added the TwistAngleRange variable.
> Now you can set all your values in one go.
> WARNING; PLEASE UPDATE YOUR .new() CALLS TO THE NEW FORMAT: 
.new(Character:Model, DataTable:RagdollProperties)
2 Likes

How can I detect if player is in ragdoll state ?

1 Like

Hello! There currently isn’t a safe way to know if the player is ragdolling, since that feature hasn’t been added yet, but will be added soon! Sorry for the inconvenience, should’ve added this before :skull:

2 Likes

v1.2.1

> Now you can call Ragdoll:destroy() to destroy the ragdoll object.
> Now you can access other ragdoll from the module by using getRagdoll()
> Now you can check if the ragdoll is currently ragdolling with ragdoll:isRagdolling()
> You can also now define a custom ID for the ragdoll to be stored in. (i.e. ragdoll with id "hello" will be stored as ragdolls["hello"])
2 Likes

Hello! For some reason the module within the link you give is only updated to v1.1. Could you please roll out a fix for this?

1 Like

I also personally would probably move away from package links as they’re less intuitive than just getting the new update of the module.

1 Like

Oh my bad, it’s actually always updated (package link)
I just put the “v1.1” in the name and forgot to change it :skull:

About the package link, I’d prefer to just leave it there.
That way whenever I update the module it will be automatically updated to the new version.
I always add the changelog inside the main module too, so people will know that it has been updated.
But if you rather just get the module from the release (Creator Store) then I’m good with that.
I’ll start to update the link for every official release.

1 Like

Updated! Thank you for your help :wink:

2 Likes

May I ask why you went with this ragdoll approach? Not to be rude or anything but I’m curious

The way you make the ragdolls is pretty weird, you clone the character and ragdoll that one while making the actual player character fully invisible and anchored in the air, storing the ragdoll in workspace in a _ragdoll folder

This may create problems if the character has scripts or GUI in them that also gets cloned, of course you can just access the character or make checks in the script for such occasions, but that’s kind of annoying

1 Like

In a part of the code i remove the scripts that are in the character, and the cloning might be a lil rough and dirty but I’ll be updating the module to make it more reliable and safe.

Thanks for the comment, you weren’t rude at all! You pointed out a possible problem that could break other aspects of the game where its used, and it’s my job to fix that and avoid interfering with the systems that developers use. Thank you!

1 Like

Also the reason why I clone the character and store it on a folder is because of performance and also to avoid interfering with other things that might be happening in the actual character. Kinda like a backup. (i.e. developer has set a custom property on the character’s humanoid and it might get overriden by the module)

Though, this is only used for the DeathBody type. Toggle will use the character straight away.

3 Likes

Bro how come this gets more likes when I basically released the same thing alongside with 3 other modules bro :broken_heart:

1 Like

Thanks for answering, by the way, not sure if you know but there’s pretty significant lag when a player gets ragdolled and you’re not the one getting ragdolled, sometimes even more than 1 second before the ragdolling actually gets replicated to other players, and this is when I have only 0.1 incoming replication lag in studio settings, it’s a bit worse in a normal server environment

Another issue I found is the struggle to actually get up after you get ragdolled, I can fix it on my end but if you want look into HumanoidStateType, toggling Animate and stopping Animator animations, it would help others using this resource.

Thanks

hello sorry, the ragdoll looks awesome from the showcase but the sample code doesn’t seem to work. besides having a missing comma after Player = Player the code still doesn’t work. the character disappears and the camera stays still.

1 Like

Exactly, same happened to me i actually have no idea why the developer didn’t make the script right

1 Like