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

Hey ive tried using this for my game and for some reason it sometimes decides to not let the ragdolls fall. Do you know any way to fix this?

What do you mean? Describe how you are using the system.

I have a whole system that has a module script that can detect when any model has a “DamageHandler” which is a script that just handles knockback, stunning, and wether or not the damage actually damages, and the script will make ragdoll true when the damageevent is activated. It turns the ragdoll to false after a certain stun time. But the problem is that sometimes when the player ragdolls or any npcs ragdoll, it just lets them hang in place. the dont fall over even with knockback force.

cant really show any footage rn because my thing suddenly decided i cant attack the dummy i set up. but i think the humanoid isnt changing states or something? Edit: Also wanted to say, for some reason the ragdolls all have a choppy movement. Almost like they have a lower framerate compared to everything else.

robloxapp-20231003-1852062.wmv (3.2 MB)
how to fix flying issue? (on npcs)

In the RagdollR6 script I removed the NeckRequired set to false line and it worked fine for me, the ragdoll works properly and when I fall into the void, ragdolled or not, I will respawn. Hope this helps! :+1:

1 Like

I had neck required set to false for my game and realised it wont be useful for others so ill update this and remove that line,

3 Likes

Bro you honestly just saved me hours of work :hushed:

1 Like

Does this work with Roblox’s new character controllers? Releasing Character Physics Controllers - #272 by Varonex_0

Yea should work fine as long as they dont break humanoid states.

1 Like

ragdoll - Clipped with Medal.tv so I tried changing the boolValue ingame and as you can see, the character moves for a split second after the boolValue is set to true before returning to normal. I think it might be because of my script that handles humanoid states?

Here it is for reference:

Script
local RunService = game:GetService("RunService")
local ContextActionService = game:GetService("ContextActionService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid : Humanoid = character:WaitForChild("Humanoid")
local humanoidRootPart: BasePart = character:WaitForChild("HumanoidRootPart") 

local controllerManager: ControllerManager = character:WaitForChild("ControllerManager")
local groundController: GroundController = controllerManager:WaitForChild("GroundController")
local airController: AirController = controllerManager:WaitForChild("AirController")
local groundSensor: ControllerPartSensor = controllerManager.GroundSensor
local currentMovestyle = controllerManager:GetAttribute("CurrentMovestyle")

local Animations = require(ReplicatedStorage.Animations.Package.AnimationsClient)

local GrindBindable = ReplicatedStorage.Remotes.GrindBindable
local ShiftLockBindable = ReplicatedStorage.Remotes.ShiftLockBindable

local function updateMovementDirection()
	local desiredDirection = humanoid.MoveDirection
	controllerManager.MovingDirection = desiredDirection

	if desiredDirection.Magnitude > 0 then -- Is the character currently moving?
		controllerManager.FacingDirection = desiredDirection
	else -- Character not moving
		controllerManager.FacingDirection = controllerManager.RootPart.CFrame.LookVector
	end
end

local function updateControllerManagerSensor()
	local raycastParams = RaycastParams.new()
	raycastParams.FilterDescendantsInstances = {character}
	raycastParams.FilterType = Enum.RaycastFilterType.Exclude

	local raycastToGround = workspace:Raycast(humanoidRootPart.Position, Vector3.new(0, -4.5, 0), raycastParams)

	if raycastToGround then -- Character is running on the ground, raycast returned something
		groundSensor.SensedPart = raycastToGround.Instance
		groundSensor.HitNormal = raycastToGround.Normal
		groundSensor.HitFrame = CFrame.new(raycastToGround.Position)

		humanoid:ChangeState(Enum.HumanoidStateType.Running) 
		controllerManager.ActiveController = groundController
	else -- Character is midair, raycast didn't return anything
		humanoid:ChangeState(Enum.HumanoidStateType.Freefall) 
		controllerManager.ActiveController = airController
	end
	
	return controllerManager.ActiveController
end


local function doJump(actionName, inputState)
	if actionName == "JUMP_ACTION" and inputState == Enum.UserInputState.Begin then
		local jumpImpulse = Vector3.new(0, 550, 0) -- jump power

		controllerManager.RootPart:ApplyImpulse(jumpImpulse)
		
		-- Jumping anim changes based on current movestyle
		local jumpTrack = Animations:GetTrack(string.format("%s.Jump", controllerManager:GetAttribute("CurrentMovestyle")))
		jumpTrack.Looped = false 
		jumpTrack:Play()
		
		humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
		
		local floor = controllerManager.GroundSensor.SensedPart
		if floor then
			floor:ApplyImpulseAtPosition(-jumpImpulse, controllerManager.GroundSensor.HitNormal)
		end
	end
end

RunService.PreAnimation:Connect(function()
	local currentController = updateControllerManagerSensor()
	updateMovementDirection()
	airController.MoveMaxForce = humanoidRootPart.AssemblyLinearVelocity.Magnitude * controllerManager.BaseMoveSpeed
	
	if currentController == groundController and groundSensor.SensedPart.Name ~= "Rail" then  
		ContextActionService:BindAction("JUMP_ACTION", doJump, true, Enum.KeyCode.Space)
	else 
		ContextActionService:UnbindAction("JUMP_ACTION")
	end	
end)

You are suppose to change the BoolValue from a server script since the joints are created on the server.

Try using a remote event and see if it works.

And for the humanoid states, just make sure you dont change it while the ragdoll is active.

Untitled - Clipped with Medal.tv Works like a charm, thanks! But is there a way you can think of that I can use to stop the HRP from staying upright? I already know how to restrict the player’s controls

This is because the humanoid state is not Enum.HumanoidState.Ragdoll. In your LocalScript try checking is the BoolValue is set to true. If it is then set the HumanoidState to ragdoll.

1 Like

This works! I just had to comment out the RunService connection that handles updating the controller and the sensors, but I’ll get around to having an actual implementation soon. If anyone’s using ragdolls with the character controllers, try this module!

1 Like

flopping all over the place - Clipped with Medal.tv Here it is fully added into my game if you’re curious. Later I’m going to add ragdolling if you hit the ground while in the middle of a trick

1 Like

Looks awesome! Can’t wait to see what your game turns into :smile:

1 Like

Thank you!

Character minimum

1 Like

flop rush cyberfunk - Clipped with Medal.tv Here it is, fully added! Doing a trick and then hitting the ground makes you flop/ragdoll. You can also hit P to ragdoll by yourself.

It’s not like your losing like 95% game performance, your only just loosing like 0.01%.