Ragdoll Script R15 and R6 [PC, Mobile, Xbox]

I have the same issue. It only really happens when the player isn’t moving when ragdolling and goes away when you add velocity.

2 Likes

Apologies for not responding and forgetting to update the module with the Bot function which I had already created for this purpose but it was in my game not in the module. I have added it, please retake the module and test stuff. Thanks for you patience. :smiling_face_with_three_hearts:

I hope it will solve the issue.


I’d suggest you use server script since client has nothing to do with it.


I have myself seen it some times and not just here but in many roblox games, I believe it’s a problem on Roblox’s end.


Let me know if there are any other bugs, I’ll try to fix as soon as I can.


Important - I create collision groups using script in module since many people are new and don’t know some stuff in studio so I did their work simple but you can minimise code by manually creating collision groups which would allow you to use module script in the build mode as well. It will throw error as collision groups don’t exist until the script makes them in game.

1 Like

In this video, I show an NPC being ragdolled. Currently, the function will unragdoll npc after 10 seconds which you can modify according to your needs. It will throw error when you unragdoll npc when it’s destroyed or inexistent.

5 Likes

So uh, The ragdoll does velocity checks that should ragdoll the player. i dont think it works with R6

This ragdoll works very nicely (and I’ve had trouble with quite a few others).

Just one small update you may want to consider - the random velocity on the head when ragdolled should be replaced as BodyVelocity has been deprecietated.

Otherwise this is the perfect ragdoll for me!

Hello! I found a bug. While this is a great module, for npc’s it’s kinda buggy.

When an NPC is ragdolled, it floats in the air. Disabling the GettingUp humanoid state does not work for me. This bug is also in your demo.
Clearly only works for players.

If anyone could tell me how to fix this it would be greatly appreciated.

This is so amazing! Thank You!!! I just added this to my game, where players can push each other. I modified it so that pushed player gets ragdolled for 3 seconds, and it became so much fun :smiley:

Tested 5-6 ragdoll scripts before this, none of them worked as I wanted. Yours was perfect <3

1 Like

Could you please look at this? I encountered an issue when using your module

Print not working after Wait() - Help and Feedback / Scripting Support - DevForum | Roblox

I know I am kind of late to this post, but can you please show documentation on how to ragdoll a user and unragdoll them? That would help alot.

	RagdollModule.Ragdoll(VictimCharacter, true)
	task.wait(3)
	RagdollModule.Ragdoll(VictimCharacter, false)

VictimCharacter - the character(player) that you’d like to ragdoll and the boolean value as the second argument is either enabling or disabling the ragdoll

As they’ve said in their post(the creator) you are able to ragdoll NPCs as well with a different method.

1 Like

OK so ive been digging into his module, i had the same problem that the NPC were not working for me. They were just floating in the air.

I found out, that he is using remote events to players, so he can change HumanoidStateType
to Ragdoll, so the body ragdolls good.
But he cannot send remote event to an npc that is server controlled.
So he have changed the HumanoidStateType on the server in the modulescript so that means, it wont do anything to the Humanoid and ragdoll is basicly floating in the air.

So my fix is:
When you set the NPCs HumanoidRootPart Network OwnerShip to nil (server) you can change the humanoid state type (How would I change the state of a dummy).

Here is my updated .Bot() function:

Module.Bot = function(bot)
	task.spawn(function()
		local H = bot.Humanoid
		bot.HumanoidRootPart:SetNetworkOwner(nil)
		if bot:FindFirstChild'HumanoidRootPart'and H.Health~=0 and bot:FindFirstChild'LowerTorso' and bot.LowerTorso.Root.Enabled==true then
			H:SetStateEnabled(Enum.HumanoidStateType.GettingUp,false)
			H:ChangeState(Enum.HumanoidStateType.Ragdoll)
			
			for _,v in pairs(H:GetPlayingAnimationTracks())do v:Stop(0)end
			bot.Animate.Disabled = true
			
			for _,v in pairs(bot:GetDescendants()) do
				if v:IsA'Motor6D'and Module.Check(v.Name) then
					v.Enabled = false
				elseif v:IsA'BallSocketConstraint' then
					v.Enabled = true
				end
			end
			wait(10)
			bot.Animate.Disabled = false
			H:SetStateEnabled(Enum.HumanoidStateType.GettingUp,true)
			H:ChangeState(Enum.HumanoidStateType.GettingUp)

			for _,v in pairs(bot:GetDescendants()) do
				if v:IsA'Motor6D' then
					v.Enabled = true
				elseif v:IsA'BallSocketConstraint' then
					v.Enabled = false
				end
			end
		end
	end)
end

Before setting network ownership to server:

After setting network ownership to server:

Hope i helped someone. Also @lagnis7859 maybe consider updating this so its good for everyone :wink: Anyways good job with the module!

5 Likes

My npc is getting ragdolled but when I try to un ragdoll it doesn’t work…

Regarding this model:

You’re missing the return object in the module-script.

Last line of the ModuleScript should be

return Module

but is in fact only

return

Resulting in errors when requiring the module.

Nice system! But the comments are missing. It would be much easier to read and understand how the script works if the comments were there.

So sorry to bump, but I noticed that your Bot function doesn’t seem to work for my r6 bots (I looked at the script, and I only saw r15 compatibility. I could be wrong though).
Do you think you might be able to add/fix this?

-EDIT

After looking at things and deleting specific checks that were stopping my ragdoll from triggering, I’ve come to realize that humanoidState can only be set on client. Is there a workaround you can add?

Very smart. You’ve solved the problem I couldn’t solve for 2 years. However, I found a silly error when I was testing that you changed the order of the script. Putting the joint changing statement below actually messed it up a bit so I just added the network ownership line without changing order. And it works like a charm.

Updated the module

1 Like

Wanted it so that players only ragdolled when they died and not from pressing any buttons, so I deleted the “Input” script, it seems to be working fine on R6. But is there anyway I can make it so that they’re more likely to fall forward or backward when they die, because usually it seems that the player is perfectly balanced and needs to be knocked over after ragdolling. Like adding some small amount of velocity in a random direction when the player dies/ragdolls?

1 Like

How to make this r6?
I beautified the module a bit :

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 = {"LeftWrist","RightWrist","LeftAnkle","RightAnkle"}

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("LowerTorso") and Character and not Character.LowerTorso.Root.Enabled) or (Character:FindFirstChild("Torso") and not Character.Torso.Neck.Enabled)) and not bool 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
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

Tried this and it didn’t work. Need help urgently


Sorry for bumping this three year old thread, but I figured I’d give people some updates. It seems the creator of the module either doesn’t play Roblox anymore, or has fully abandoned his account.

Here's evidence of that

It seems people are still having issues with this system, so let me run through the full system real quick.

The system works with R15, and R6.

Here’s evidence of this;
image image

  • There is a bot function that works, you simply send the model of the bot to the Module.

How to use the bot function

You need to require the module from a regular script, running on the server… and send the instace, meaning the model, of the NPC body you want to ragdoll. Here’s an example; (Whether you can disable the ragdoll on the NPC, I have no idea.)

local Module = require(game.ServerScriptService.Module)

Module.Bot(game.Workspace.Dummy) --[[You need to send the instance, meaning the model of the NPC, to the function to ragdoll it.]]

The only recommendation I can give that could make the system a bit more efficient is moving the Module.Check function above the Module.Ragdoll function in the ServerScriptService Module.


Due to the creator, either leaving Roblox, or becoming fully inactive on this account… there is practically no coding, or bug support for this system. If you have issues with the ragdoll system, your best option is to post it under #help-and-feedback:scripting-support category.

I may release my ragdoll system once I’ve put it through some stress-testing, and I know it’s efficent, and easy to use. Until that happens though, I’d look at other ragdoll sources, or try to improve the coding here on your own.


4 Likes