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.