Ragdoll during animation causes HRP to snap to torso

For some reason, ragdolling a character mid-animation causes the character to teleport to wherever their torso was during the animation. This is an issue for me because if an animation moves a character’s torso forward, and they get ragdolled mid-animation, they can go through walls (and usually fall into the void)

I have tried multiple things, such as stopping the animation right before they get ragdolled, Moving the HRP to the correct position after the ragdoll (tried this with the torso too), stuff like that.
I am not sure how to fix this correctly, and I don’t see anyone else having a similar problem.

This is the code used for the ragdoll by the way.

local RagdollableLimbs = {
	"Torso",
	"Head",
	"Left Arm",
	"Left Leg",
	"Right Arm",
	"Right Leg"
}
for i, v in Character:GetDescendants() do
	if v:IsA("Motor6D") then
		if v.Part1 and v.Part0 then
			if table.find(RagdollableLimbs,v.Part1.Name) then
				local a0, a1 = Instance.new("Attachment"), Instance.new("Attachment")
				a0.CFrame = v.C0
				a0.Name = "RagdollAttachment"
				a1.CFrame = v.C1
				a1.Name = "RagdollAttachment"
				a0.Parent = v.Part0
				a1.Parent = v.Part1
				local b = Instance.new("BallSocketConstraint")
				b.Attachment0 = a0
				b.Attachment1 = a1
				b.Parent = v.Part0
				v.Enabled = false
			end
		end
	end
end

The animations and ragdolls are both handled on the server.
Also, I don’t know if this is important or not, but the character’s PrimaryPart is the HRP.

Have you tried stopping the animations with zero fade?

animationTrack:Stop(0)

Maybe also waiting a heartbeat after stopping the animations with task.wait()?

This might be a network ownership thing, where the ragdolling is done on the server but the client has ownership of the character, so it might be hard to fix.

1 Like

It seems like adding task.wait() fixed it. Thank you for the help.

1 Like

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