How to make a ragdoll part?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to make a part that ragdolls a player when touched.
  2. What is the issue? Include screenshots / videos if possible!
    I have no idea how to get started.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I have run through the devforum but the scripts provided either ragdolls only on death or it is too complicated.

I have never done ragdolling scripts before, so I’m sorry if there are things that I don’t understand.

5 Likes

If your game is based on R6 physics, you can try this asset: ragdoll part - Creator Store (roblox.com)

3 Likes

My game is unfortunately R15 though

4 Likes

If its r15 the i found this topic, This Will Help.

or if you want to fall like ragdoll without a moving only a jump then HumanoidStateType will help
EXAMPLE RAGDOLL CODE FROM HUMANOIDSTATETYPE
make localscript and put localscript into startercharacterscripts

game:GetService("UserInputService").InputBegan:Connect(function(input, gameProccesed) --function for USERINPUTSERVICE
	if input.KeyCode == Enum.KeyCode.R then -- if R key is pressed
		game.Players.LocalPlayer.Character:FindFirstChildWhichIsA("Humanoid"):ChangeState(Enum.HumanoidStateType.Ragdoll) -- changes state
	end
end)

part touching script ragdoll (with a module)

local cooldown = false

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
		local module = require(game.ServerScriptService.Module)
		module.Ragdoll(plr.Character)
        cooldown = true
		wait(1)
		cooldown = false
	end
end)

part touching without a module

local cooldown = false

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		
		local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
		hit.Parent:FindFirstChild("HumanoidRootPart"):SetNetworkOwner(nil)
plr.Character:FindFirstChildWhichIsA("Humanoid"):ChangeState(Enum.HumanoidStateType.Ragdoll)  
        cooldown = true  
        wait(1)
        cooldown = false
	end
end)

i added cooldown so when a player touches you have to wait 1 seconds.

for a part please use script and put script into part

works with r6 and r15 characters.

3 Likes

I found the community resource pretty helpful! The problem is that it contains a lot of information, and I have no idea how to convert the script from ragdolling upon inputting a key to just touching a part. The ragdoll is pretty smooth

4 Likes

Copy the code that does the ragdolling and put it under your own condition

3 Likes

like i said you can use humanoidoottype code without module.

and there is a input code which you can change. code from a code called contextbindactions
change these key script to whatever you want

1 Like

also i said this use normal script and put that script into part :slightly_smiling_face:
like parent the normalscript into your part.

1 Like

The ragdoll works now! Except… for some reason the player is not guaranteed to get up. After they ragdoll, theres a good chance that they are permanently stuck onto the ground, and are unable to get up. Is there a solution to this? I tried changng the humanoid state type but i realised that the ragdoll script used doesnt change he humanoid state type at all.

1 Like

use this script

Source: Change humanoid state in server script

EDIT : the community resource code ragdoll bugged. or broken.

also if there humanoidstatetype code here then delete the ragdoll module code that should work

Hey, I got notified that you linked my post and just wanted to mention that the post sent is a little outdated.

I’ve created my own ragdoll script that works really well and although I can’t share it, I can give a good piece of advice.

Try avoid setting the network owner for a ragdoll on a server script. Instead, make a remote event and add a client script to “starter player/starter character” (I prefer starter character) that is responsible for setting the humanoid state type when the event is fired. Doing so makes the character → ragdoll transition much smoother and removes a lot of the ‘choppyness’ seen in a lot of ragdoll code.

I dont know much about this thread or the problem but I hope this little bit of advice can help:

Ragdoll is a bool value that is responsible for activating the ragdoll in my code. Replace this with your remote event’s onclient event

-- Script.Parent = StarterCharacter

--REPLACE ragdoll.Changed TO AN EVENT YOU CREATE
ragdoll.Changed:Connect(function(newVal)
	if newVal then
		humanoid:ChangeState(Enum.HumanoidStateType.Ragdoll)
		humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, false)
	else
		humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, true)
		humanoid:ChangeState(Enum.HumanoidStateType.Ragdoll)
	end
end)
1 Like

Ok, I modified the script and it works now! Thanks for your help

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.