Ragdoll character freezing issue

Hello, I’m trying to make a smooth transition with ragdolling in my game as currently whenever I send someone into a ragdoll state it causes them to freeze. Nothing I’ve tried from related articles have helped. I’ve especially tried tinkering with the RootJoint but nothing seems to work. This odd freezing occurs when the player goes into and out of ragdoll and I’m simply at a loss.

The code I run builds the joints on the server disables all of the motor6Ds sets the client’s humanoid state to physics.

function RagdollService:RagdollCharacter(char: Model, duration: number?)
    local plr = Players:GetPlayerFromCharacter(char)
    local hum = char:FindFirstChildOfClass("Humanoid")
    local hrp = char:FindFirstChild("HumanoidRootPart")
    if not hrp then return end
  
    if plr then 
        self.Client.Ragdoll:Fire(plr)
    else
        hum:ChangeState(Enum.HumanoidStateType.Physics) --for npc
    end
  
    Knit.GetService("StateService"):SetStateOverride(plr or Knit.GetService("NPCService"):GetNPCFromCharacter(char), Enums.State.Ragdolled, duration)
  
    RagdollService:BuildJoints(char)
    RagdollService:EnableMotor6D(char, false)
  
    hum.AutoRotate = false
    hrp.CanCollide = false
  
    if not duration then return end
    if self._RagdollTimers[char] then coroutine.close(self._RagdollTimers[char]) end
    self._RagdollTimers[char] = coroutine.create(function()
        task.wait(duration)
        self:UnragdollCharacter(char)
    end)
    coroutine.resume(self._RagdollTimers[char])
end

Perhaps I’m doing something wrong, but I can’t see it.

1 Like

Right before this line, try setting the network owner of the NPC to nil.

1 Like

this problem affects only players, npcs are just fine.

I fixed the issue a little bit by actually reenabling the rootjoint. This made the ragdoll itself a little more laggy, however, the ragdoll itself only freezes briefly once at the beginning (which is to be expected considering there has to be some time for the joints to replicate)

1 Like

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