[Updated] Perfect R6 Ragdoll - Easiest Ragdoll System for R6 Avatars

R6 compatibility code :

local RagdollModule = {}

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local PhysicsService = game:GetService("PhysicsService")

local Events = ReplicatedStorage:WaitForChild("Events")

local RemoteEvent = Events.Ragdoll

local Table = {"Left Shoulder","Right Shoulder","Left Hip","Right Hip","Neck"}

function RagdollModule:Ragdoll(Character : Model, bool : boolean)
	local Humanoid : Humanoid = Character.Humanoid
	local Player = Players:GetPlayerFromCharacter(Character)
	if Character.Humanoid.Health > 0 and (Character:FindFirstChild("Torso") and not Character.Torso.Neck.Enabled) and bool == false then
		if Player then
			RemoteEvent:FireClient(Player,false)
		else
			Character.Animate.Disabled = false
			Humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp,true)
			Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
		end
		for _,v : Instance in ipairs(Character:GetDescendants()) do
			if v:IsA("Motor6D") then
				v.Enabled = true
			elseif v:IsA("BallSocketConstraint") then
				v.Enabled = false
			end
		end
	else
		if Player then
			RemoteEvent:FireClient(Player,true)
		else
			Humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp,false)
			Humanoid:ChangeState(Enum.HumanoidStateType.Ragdoll)
			for _,v in ipairs(Humanoid.Animator:GetPlayingAnimationTracks())do 
				v:Stop(0)
			end
			Character.Animate.Disabled = true
		end
	
		for _,v : Instance in ipairs(Character:GetDescendants()) do
			if v:IsA("Motor6D") and RagdollModule:Check(v.Name)then
				v.Enabled = false
			elseif v:IsA("BallSocketConstraint") then
				v.Enabled = true
			end
		end
	end
	return
end

function RagdollModule:Check(Name : string)
	if table.find(Table,Name) then
		return true
	else
		return false
	end
end

function RagdollModule:Joints(Character : Model)
	local Humanoid : Humanoid = Character.Humanoid
	Humanoid.BreakJointsOnDeath = false
	Humanoid.RequiresNeck = false
	
	for _,v : Instance in ipairs(Character:GetDescendants()) do
		if v:IsA("Motor6D") and RagdollModule:Check(v.Name) then
			local BallSocketConstraint = Instance.new("BallSocketConstraint")
			local Attachment0 = Instance.new("Attachment")
			local Attachment1 = Instance.new("Attachment")
			
			Attachment0.CFrame = v.c0
			Attachment1.CFrame = v.C1
			Attachment0.Parent = v.Part0
			Attachment1.Parent = v.Part1
			
			BallSocketConstraint.Attachment0 = Attachment0
			BallSocketConstraint.Attachment1 = Attachment1
			BallSocketConstraint.LimitsEnabled = true
			BallSocketConstraint.TwistLimitsEnabled = true
			BallSocketConstraint.Enabled = false
			BallSocketConstraint.Parent = v.Parent
		elseif v:IsA("BasePart") then
			v.CollisionGroup = "RagdollA"
			if v.Name == "HumanoidRootPart" then
				v.CollisionGroup = "RagdollB"
			elseif v.Name == "Head"then
				v.CanCollide = true
			end
		end
	end
end

return RagdollModule
5 Likes

I have this issue with the ragdoll script, i figured that when i ragdoll, then reset, i am dead forever. Does anybody know why this is happening? I also figured that when you ragdoll, then die, the server doesn’t detect that you are dead.

4 Likes

legend, absolute legend, great work

3 Likes

Most likely a script or setting is preventing the game from triggering the respawn. Usually happens when two rigs with Humanoids in them are welded together.

1 Like

i did some testing with prints and i figured that when you ragdoll, then die, the server doesnt print, but the client does still.

1 Like

usually both client and server print when you ragdoll normally, but for some reason only the client prints when i ragdoll then die

1 Like

The name of this script suits it. Amazing work!

2 Likes

Just ran into a problem with this Ragdoll script. :frowning:
My ragdoll can just fly up. (NPC Version)
robloxapp-20231003-1852062.wmv (3.2 MB)

2 Likes

This is because of platform stand.
To fix this you need find in humanoid find “PlatformStanding” and inside script make like “Humanoid.PlatformStanding = true”.

2 Likes

whenever a player falls into the void they stay dead forever, any way to fix this?

2 Likes

I think its to do with ‘NeckRequired’, I also had this issue

2 Likes

Thanks for making this, I converted and modified this to a module script. I needed something seamless like this, and you got me covered.

1 Like

can you tell me how did you manage to solve it?

1 Like

I had the same issue myself. I did not do anything about NeckRequired to solve it but this script worked for me (In ServerScriptService):

local RUS = game:GetService("RunService")
RUS.Heartbeat:Connect(function()
   for i,v in pairs(game.Players:GetPlayers()) do
   	if v.Character then
   		if not v.Character:FindFirstChild("HumanoidRootPart") and v:HasAppearanceLoaded() then
   			v:LoadCharacter()
   		end
   	end
   end
end)

This code basically just respawns the player when the glitch happens.

1 Like

Nah, after some testing, it’s not about the module. Roblox doesn’t fire .Died on the server if he falls in the void.

In-short, don’t make the player fall in the void, thus you wouldn’t have to do unworthy checks like this.

1 Like

btw it’s also weird that whenever I don’t use the module it actually does fire .Died so idk.

1 Like

Thanks a lot! Love this resource :smile:

2 Likes

Hi, can this system be run only on a client? I am trying to make it so instead of running on the server, each client gets alerted that the npc is ragdolled for a smoother experience.

1 Like

Yeah, that literally means it is the module’s fault. RequiresNeck kills the player if their neck is gone, so if it’s disabled then the player can’t die.

1 Like

Hello, this system is cool. Would it be ok if edited this code to fit into a more modular form for use in a project?

1 Like