Smooth R6 Ragdoll for Players and NPCs (Plug-and-Play)

Assuming you used a key input script to trigger the ragdoll, how can you accomplish that effect? I’ve tried a few things and I can’t seem to get it to work properly. I’m sure it’s very simple, but I’m a beginner programmer with very limited knowledge and some help would be appreciated.

Yes, I know I’m late to the party.

2 Likes

This ragdoll system really helped me a lot! Thank you so much!

2 Likes

If you dont mind me asking, what did you change / what did you do to make the ragdoll smoother, Im just curious.

Thanks!

Thank you for asking, because apparently I didnt even update the script link :man_facepalming:

However, the change that makes it so much smoother is the following:
On ragdoll, instead of disabling all the character/npc’s Motor6Ds, I disable all the Motor6Ds and leave the HumanoidRootPart’s Motor6D enabled, so it’s enabled at all times, and that somehow doesn’t mess with the replication.

1 Like

NPCs don’t have colliding limbs or stun but players do, any idea why?
5CasTaPO5

2 Likes

Download the scripts again and try again (here)
I forgot to change the humanoid state :skull: .

1 Like

This script isn’t working for me. The player’s animations still play and even if you disable the animation script, the ragdoll is still not working. This is a brand new place with no other scripts and the ragdoll script is the latest version. Hopeful for a fix very useful
image

That’s because you are setting RagdollTrigger locally, you need to set it on the server side

BIG NOTE to anyone who will want to make server side r6 ragdoll.
I spent a lot of time trying to do this because nowhere is documented that HumanoidRootPart networkownership SHOULD BE setted after Stepped event, otherwise networkownership will be reseted (I did know that physics should be setted after this event, but nowhere it was told in context of networkownership, I just thought that it’s stupid and willn’t work).
Now it’s work as intended! No flying ragdoll characters. Thank you, Aspecturu for your simple but good module, ofcourse I refactored code, but it’s all about ragdoll logic. (Not like I never wrote ragdoll modules, I did. But they all were deleted because of flying ragdoll dolls).
I will investigate future problems related to ragdoll (If they will exist) and update info about their solution

image

1 Like

I am not really sure what issue you are trying to fix here, it’s not a good idea to set the ownership of a player’s hrp to nil (aka the server), doing so will cause some very bad user experience because the player is no longer in instant control of their character, so what should be done instead is ragdolling the player on both the server and the client (Look at the R6RagdollClient script).

As for NPCs, their network owner is the server, it is explicitely being set by the script so that no player will automatically take ownership of NPCs and break the ragdoll. So all you have to do is set the RagdollTrigger to true to ragdoll and false to unragdoll.

I don’t want to give control to player of his character while he is in ragdoll state (Because it can be bypassed on client).

I give networkowner back to player on unragdoll call btw, I just don’t trust client.
Also I do changeState to GettingUp for unragdoll on client

Maybe it’s only my issue, but If I willn’t change networkowner to server, then I can just move character on client (So exploiters will have big advantages)


Also the link on the model desc doesn’t work.

1 Like

Just add the collision group as mentioned in the tutorial. But on second thought, I should just create the collision group in the script.

1 Like

Hey, I don’t know if I’m stupid or not, but I can’t figure out how to get it to ragdoll on a keypress, as you said, I attempted to turn the bool value to true using a server script, but it doesn’t work.
Here is both my local and server script for turning the bool value to true:

--Local Script

local UIS = game:GetService("UserInputService")

local raggy = game.ReplicatedStorage:FindFirstChild("RagdollEvent")
local character = script.Parent
UIS.InputBegan:Connect(function(key)
	if key.KeyCode == Enum.KeyCode.R then
		raggy:FireServer(character)
	else
		return nil
	end
end)
--ServerScript

local raggy = game.ReplicatedStorage:FindFirstChild("RagdollEvent")

raggy.OnServerEvent:Connect(function(character)
	local bool = character:FindFirstChild("RagdollTrigger")
	bool.Value = true
end)

The error that keeps coming up is that I attempted to write a value to nil, hinting that it is unable to find RagDollTrigger, which for the life of me I can’t figure out why. Could be because I’m a beginner scripter.
¯_(ツ)_/¯

The first parameter of OnServerEvent will always be the player object of who sent the event.

Change it to:

raggy.OnServerEvent:Connect(function(player, character)

I didn’t have to use breakjoints, it would ragdoll properly without it, however it would start moving quite madly. To fix it I used platform stand instead, and it worked properly then, here’s the script if you wanna try it,

local raggy = game.ReplicatedStorage:FindFirstChild("DeathEvent")

raggy.OnServerEvent:Connect(function(player, character)
	local bool = character:FindFirstChild("RagdollTrigger")
	local hum = character:FindFirstChild("Humanoid")
	if bool then
		if bool.Value == false then
			hum.PlatformStand = true
			bool.Value = true
			wait(0.3)
			hum.PlatformStand = false
			
		end
	end

end)

PS: I did this in a server script, with the checking if it’s dead or not in a local script, which would fire an event.

1 Like

Change that to this:

local raggy = game.ReplicatedStorage.RagdollEvent

raggy.OnServerEvent:Connect(function(player)
	local character = player.Character
	local bool = character.RagdollTrigger
	bool.Value = true
end)

Oh yeah that works too, I forgot to mention the first reply worked. :skull:

1 Like