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.