I’m using this server-sided ragdoll and it works pretty smoothly thanks to this this post.
To make the ragdoll smooth, I disabled the RootJoint of the HRP and enabled it after ragdoll.
This is how I did it:
if not ragdoll then
-- i also have to add this to prevent the player from falling into the void
local weldConstraint = Instance.new("WeldConstraint")
weldConstraint.Part0 = characterSubject.PrimaryPart
weldConstraint.Part1 = characterSubject.Torso
weldConstraint.Name = "RagdollWeld"
weldConstraint.Parent = characterSubject.PrimaryPart
characterSubject.PrimaryPart.RootJoint.Enabled = false
else
characterSubject.PrimaryPart.RootJoint.Enabled = true
if characterSubject.PrimaryPart:FindFirstChild("RagdollWeld") then
characterSubject.PrimaryPart.RagdollWeld:Destroy()
end
end
The problem now is that because I disabled the RootJoint, whenever a force like BodyVelocity
is acting on the ragdolled player, the player’s torso will move first and the all the other limbs will lag behind (almost like detaching and reattaching) . Btw this is only appears on the other clients, there is no problem on the ragdolled player’s client.
Here’s a video of what I mean:
I tried setting the network ownership of the ragdolled player to the server or the attacking player, but it still makes the player’s limbs lag behind the torso.
I’ve also tried creating a clone of the ragdoll on every client using AlignOrientation
and AlignPosition
, but that makes the ragdoll look really weird and sometimes it stops in the middle of the air.
Does anyone know how to prevent the limbs from lagging behind torso?