R6 Ragdoll System

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)

2 Likes

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.

1 Like

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:

https://www.roblox.com/library/5696985186/Ragdoll-Module

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).

4 Likes

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?

2 Likes

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!

4 Likes

Hey! I don’t know if it’s a good time to ask but, how is progress on the updates?

Can you make a togabble ragdoll. Like when you punch a player you can fire an event for it to ragdoll then it unragdoll after a certain amount of time.

Hey all, I apologize for the extremely late reply. I’ve been really busy with my school for the past month or so. I am listening to your feedback and I am going to start working on a major overhaul this weekend. It’ll take me a few days to do. This overhaul will expose a ton of API and lots more customization. Thank you for your patience.

8 Likes

Is it updated now?

if yes, where do I get the updated one

if no, when its updated can you tell

thanks

1 Like

This is a good ragdoll system and all but it’ll be very nice if you could make it so that you ragdoll if you fall from a certain height. You should also make it so that you can press a key to ragdoll and press it again to get up, that’d be lovely

4 Likes

How could I rely it on an if statement? It’s based off a function, Humanoid.Died, an if statement for example;
if Humanoid.Health = >10 then

end