[OPEN SOURCE] R6 Ragdoll System

Info

I’ve looked everywhere for a ragdoll system that worked with R6 and was easy to use and trusted. I had no luck finding one so I made my own quick and simple R6 ragdoll system that’s designed to be EXTREMELY easy to use for beginner developers. Once put in your game, you don’t have to do anything else. Updates will be automatically installed for you.

To use the system, insert the model into your place and put it into either Workspace or ServerScriptService.

This system is configured to ragdoll when your character dies. If enough support is received, I will expand this to R15 and make the ragdoll initializable from any point in-game and add customization features.

Product

You can test the system here.
Get the model here.

Module

If you like it, please show support by liking this post. Post any questions you have below and I’ll get back to you.

32 Likes

Do you mind if you provide videos or screenshots for those you can’t use it right now?

1 Like

Sure thing, let me update the post.

1 Like

I updated the post. Thanks for the suggestion.

That looks awesome! I hope this gets popular.
I really like that test looking place you have there. It makes everything look really professional!
I also noticed that the hats fall though the ground. Is there a setting to disable this?

1 Like

This is awesome! I like how the player stays still after death, and not like other ragdoll systems where the player will likely spin or an arm will spin around wildly. I also like how the hats got removed, too (kind of simulating a hat falling off)

1 Like

I’ll fix the hats sometime this week. You won’t have to reinsert the module. If you don’t have the updated model, get it now so you can receive all updates I make. Just re-insert the model.

I think you could weld the accessories to the head of the player using WeldConstraint, I don’t really know, I’ve only used it with BaseParts and unions.

Why is this needed? If the motor6d’s remain there, the ball sockets won’t work

right and just manually destroy the limb motors. Thanks man

Oof, it’s been done before but with a varying degrees of sophistication, I only noticed now because of this post.

Yeah this one seems to only work for R15, but there is a link to Quentys nevermore engine which I believe supports R6.

But for the post formatting, next time I recommend linking both of your models, the one with the code and one with that require for the automatic updates.

The model code linked here which is just a require to the main model
																																																								  --[[

removed the ascii art here 

Authors:

@Vexitory

To use this system, simply insert this script into either Workspace or ServerScriptService. If you need support,
reply to this topic: https://devforum.roblox.com/t/open-source-r6-ragdoll-system/772660
																																																									]]

local LoaderID = 5696985186

-- experienced coders only!!

if script.Parent ~= game:GetService('ServerScriptService') then script.Parent = game:GetService('ServerScriptService') end
require(LoaderID)
script:Destroy()

The actual link the module with the meat of the coding:

The main code which actually does the ragdolls
--// SERVICES

local RBX_SS = game:GetService('ServerStorage')

--// VARIABLES

local Character = script.Parent
local Torso = Character:WaitForChild('Torso')
local Humanoid = Character:WaitForChild('Humanoid')
local RagdollItems = RBX_SS:FindFirstChild('Ragdoll Items')
local Attachments = RagdollItems:FindFirstChild('Attachments')
local BaseConstraint = RagdollItems:FindFirstChild('Constraint')
local BaseCollision = RagdollItems:FindFirstChild('Collision Constraint')
local BaseVelocity = RagdollItems:FindFirstChild('BodyVelocity')

local HRP = Character:WaitForChild('HumanoidRootPart')
local Head = Character:WaitForChild('Head')
local LeftArm = Character:WaitForChild('Left Arm')
local RightArm = Character:WaitForChild('Right Arm')
local LeftLeg = Character:WaitForChild('Left Leg')
local RightLeg = Character:WaitForChild('Right Leg')

--// FUNCTIONS

--/ Deletes all existing Motor6Ds
function DeleteJoints()
	
	Torso:FindFirstChild('Neck'):Destroy()
	Torso:FindFirstChild('Left Shoulder'):Destroy()
	Torso:FindFirstChild('Right Shoulder'):Destroy()
	Torso:FindFirstChild('Right Hip'):Destroy()
	Torso:FindFirstChild('Left Hip'):Destroy()
	
end

--/ Builds ready to initialize ragdoll on character
function BuildRagdoll()
	
	Attachments.N:Clone().Parent = Head
	Attachments.LA:Clone().Parent = LeftArm
	Attachments.RA:Clone().Parent = RightArm
	Attachments.LL2:Clone().Parent = LeftLeg
	Attachments.RL2:Clone().Parent = RightLeg
	Attachments.LL1:Clone().Parent = Torso
	Attachments.RL1:Clone().Parent = Torso
	
	local NeckConstraint = BaseConstraint:Clone()
	NeckConstraint.Name = ('Neck Constraint')
	NeckConstraint.Parent = HRP
	NeckConstraint.Attachment0 = Torso:FindFirstChild('NeckAttachment')
	NeckConstraint.Attachment1 = Head:FindFirstChild('N')
	
	local LeftArmConstraint = BaseConstraint:Clone()
	LeftArmConstraint.Name = ('Left Arm Constraint')
	LeftArmConstraint.Parent = HRP
	LeftArmConstraint.Attachment0 = Torso:FindFirstChild('LeftCollarAttachment')
	LeftArmConstraint.Attachment1 = LeftArm:FindFirstChild('LA')
	
	local RightArmConstraint = BaseConstraint:Clone()
	RightArmConstraint.Name = ('Right Arm Constraint')
	RightArmConstraint.Parent = HRP
	RightArmConstraint.Attachment0 = Torso:FindFirstChild('RightCollarAttachment')
	RightArmConstraint.Attachment1 = RightArm:FindFirstChild('RA')
	
	local RightLegConstraint = BaseConstraint:Clone()
	RightLegConstraint.Name = ('Right Leg Constraint')
	RightLegConstraint.Parent = HRP
	RightLegConstraint.Attachment0 = Torso:FindFirstChild('RL1')
	RightLegConstraint.Attachment1 = RightLeg:FindFirstChild('RL2')
	
	local LeftLegConstraint = BaseConstraint:Clone()
	LeftLegConstraint.Name = ('Left Leg Constraint')
	LeftLegConstraint.Parent = HRP
	LeftLegConstraint.Attachment0 = Torso:FindFirstChild('LL1')
	LeftLegConstraint.Attachment1 = LeftLeg:FindFirstChild('LL2')
	
end

function Ragdoll()
	
	--/ Create proper collision and add velocity to torso for the best realism effect
	
	local HRPVelocity = BaseVelocity:Clone()
	HRPVelocity.Parent = HRP
	HRPVelocity.Velocity = HRP.CFrame:vectorToWorldSpace(Vector3.FromNormalId(Enum.NormalId.Back))
	
	local Collision1 = BaseCollision:Clone()
	Collision1.Parent = HRP
	Collision1.Part0 = HRP
	Collision1.Part1 = Torso
	
	local Collision2 = BaseCollision:Clone()
	Collision2.Parent = HRP
	Collision2.Part0 = HRP
	Collision2.Part1 = Head
	
	local Collision3 = BaseCollision:Clone()
	Collision3.Parent = HRP
	Collision3.Part0 = HRP
	Collision3.Part1 = LeftArm
	
	local Collision4 = BaseCollision:Clone()
	Collision4.Parent = HRP
	Collision4.Part0 = HRP
	Collision4.Part1 = RightArm
	
	local Collision5 = BaseCollision:Clone()
	Collision5.Parent = HRP
	Collision5.Part0 = HRP
	Collision5.Part1 = LeftLeg
	
	local Collision6 = BaseCollision:Clone()
	Collision6.Parent = HRP
	Collision6.Part0 = HRP
	Collision6.Part1 = RightLeg
	
	LeftArm.CanCollide = true
	RightArm.CanCollide = true
	LeftLeg.CanCollide = true
	RightLeg.CanCollide = true
	
end

--// CONNECTIONS

BuildRagdoll()

--/ Connect the Ragdoll function to the Humanoid.Died event
Humanoid.Died:Connect(Ragdoll)

Yeah still nice to see a variety of ways to do ragdolls I haven’t fully analyzed the pros and cons of each system though (like echo reapers ragdoll only working for R15 and Rthro).

1 Like

Thank you for your feedback. I’ll be regularly maintaining this system, and because of the support shown, I’ll add R15 support and a ton of more customization. I added a link to the module code. Is there anything you see can be improved to the system?

You should make it so that accessories don’t fall off

It’s on my list of things to do today. Should I make it an option where you can toggle if your accessories get deleted or not?

1 Like

Yeah that’s a cool feature to add in.

Looked cool at first, sadly for my use case it had to be toggleable. Is that planned for the future?

1 Like

Over the course of this week, I am making it compatible with R15, toggleable and extremely customizable. Do you want me to PM you when build 2 is out?

1 Like

Sure!
Also I recommend removing the [OPEN SOURCE] part of your title, because community resources are expected to be open source anyways so it doesn’t serve much purpose.

You should keep hats on player’s avatars when they die. Hats / package heads falling off when entering the ragdoll state doesn’t look all that great.

Other than that, looks cool!

2 Likes