R15 / Rthro Ragdolls

Here’s how it looks from the servers point of view.

3 Likes

This looks like what happens when an R15 character has no HipHeight, or the bottom of its HumanoidRootPart touches the ground.

3 Likes

Seems to be broken for me
ReplicatedStorage.RagdollHandler:20: attempt to index nil with ‘GetChildren’

function setRagdollEnabled(humanoid, isEnabled)
	local ragdollConstraints = humanoid.Parent:FindFirstChild("RagdollConstraints")
	
	for _,constraint in pairs(ragdollConstraints:GetChildren()) do -- ERROR HERE
		if constraint:IsA("Constraint") then
			local rigidJoint = constraint.RigidJoint.Value
			local expectedValue = (not isEnabled) and constraint.Attachment1.Parent or nil
			
			if rigidJoint.Part1 ~= expectedValue then
				rigidJoint.Part1 = expectedValue 
			end
		end
	end
end

The only changes I made were

  1. Removed the TestScript
  2. Add the ragdoll using my own character manager.
local function SetupRagdoll(player, character)
	player.CharacterAppearanceLoaded:Wait()
	wait(0.1)
	
	local Humanoid = character:FindFirstChildOfClass('Humanoid')
	buildRagdoll(Humanoid)
end

function CharacterManager.Setup(player)
	player:LoadCharacter()
end

function CharacterManager.CharacterAdded(player, character)
	SetupRagdoll(player, character)
	
	TagManager(player, character)
	
	character.Humanoid.Died:Connect(function()
		for i, v in pairs(Settings.ACTIVE_PLAYERS) do
			if v == player then
				table.remove(Settings.ACTIVE_PLAYERS, i)
			end
		end
		
		CharacterManager.Setup(player)
	end)
end


-- Get's fired like so
player.CharacterAdded:Connect(function(character)
	CharacterManager.CharacterAdded(player, character)
end)

Also getting this error


Which prevents the player from respawning. Note, this error only occurs when being killed via a weapon. For some reason it all stills works for resetting

2 Likes
CharacterAppearanceLoaded

Isn’t very reliable. Can you verify it is firing and that the ragdoll constraints are being created in the explorer?

6 Likes

I mean, that’s what you use in your code tho?

It works for resetting. Only is buggy when being killed using a weapon

2 Likes

I am having issues. I am trying to keep the Ragdoll on death. What I currently do is clone the character a couple seconds after it dies but then the Ragdoll returns to a bricked state where the contraints are “Enabled” but don’t ragdoll.

2 Likes

There’s still countless problems with this :confused:

When a player dies, it does the ragdoll, but the dead player can still move around (as like their camera) and they don’t respawn
https://gyazo.com/3b4f63839a36e7b1d20e0322307a2d82

4 Likes

There are a number of underlying issues with humanoids that prevent ragdolls in general from behaving properly. Humanoid state randomly fails to set, resets when network ownership changes, and doesn’t replicate, which can cause the issues you are seeing. You would need to file a bug report for this.

As for not respawning, these ragdolls don’t touch anything in that area. What may be happening is that your game is running slow which both 1) exacerbates the humanoid state issues and 2) causes issues with respawn.

10 Likes

Has anyone figured out a solution to this problem?

1 Like

Yes! Set ownership of the cloned ragdoll to the server, and re-set the Humanoid state to physics.

1 Like

@EchoReaper, Hi

I have found an interesting bug and I have decide to ask you for assistance on finding the source after I did some debugging but I couldn’t find what is causing this:

I’m not entirely sure how attachment.Name could be indexing nil when it clearly prints LeftLowerArm

Code
local function buildAttachmentMap(character)
	local attachmentMap = {}
	
	-- NOTE: GetConnectedParts doesn't work until parts have been parented to Workspace, so
	-- we can't use it (unless we want to have that silly restriction for creating ragdolls)
	for _,part in ipairs(character:GetChildren()) do
		if part:IsA("BasePart") then
			for _,attachment in ipairs(part:GetChildren()) do
				if attachment:IsA("Attachment") then
					local jointName = attachment.Name:match("^(.+)RigAttachment$")
					local joint = jointName and attachment.Parent:FindFirstChild(jointName) or nil
					
					if joint then
						print(joint,joint.Part0,attachment.Name)
						print("joint,joint.Part0,attachment.Name")
						attachmentMap[attachment.Name] = {
							Joint = joint,
							Attachment0=joint.Part0[attachment.Name]; 
							Attachment1=joint.Part1[attachment.Name];
						}
					end
				end
			end
		end
	end
	
	return attachmentMap
end

I would like to mention that I have never modified your Module, I have read through the source multiple times and have a good idea of what it does and how it works.

I’m more than happy to send you the Repro file privately.

3 Likes

I have the solution for the “Phase through object” bug.

You need to disable/enable the collision on the humanoidRootPart when the ragdoll is active/deactive. It’s set to always disabled when the ragdoll is created, but this is not correct.

function setRagdollEnabled(humanoid, isEnabled)
	
  ...

	local rootPart = humanoid.Parent:FindFirstChild("HumanoidRootPart")
	if rootPart then
		rootPart.CanCollide = not isEnabled
	end 

end
3 Likes

Also it’s possible to simply send a manual event from the client to the server, when the clients humanoid state changes, and apply the state manually to the players humanoid on the server. This fixes the bug in 99.9% of cases.

My code for doing this is not super pretty, but it works well enough.

3 Likes

(Pretty sure the humanoid state change bug has been fixed with the recent updates to humanoids btw!)

1 Like

Where do I put the script? New to ragdolls.

Hi, I was wondering if I should just ignore this error (wich btw, I get the second error on the screenshot 5 times on the output when I hit play) or not, since it works anyways and it also errors on the demo place. https://i.gyazo.com/89ff0a39ada6c9ba3fa15c3c49ca7139.png .

1 Like

@EchoReaper Does the module works with this?
Dogu15 Rig [Layered]

2 Likes

I personally think it should. It uses attachments as reference.

1 Like

Yes, it does:

6 Likes

How weird, i installed the dogu15 module and the reagdoll module in a test place, then i pressed R, and nothing happened.

Maybe you just run a code that makes thoose characters ragdoll?

1 Like