I am making a ragdoll script for NPCs where I set their HumanoidStateType to Physics/Ragdoll. However, even when I manually disable all other state-types, the HumanoidStateType continuously defaults to “Running” when I apply a BodyVelocity to the HRP.
Here is the part of the script where I change the HumanoidStateTypes:
function HitHandler.Knockback(humrp: Part, name: string, maxForce: number, direction: Vector3, force: number, duration: number)
warn(humrp.Parent.Humanoid:GetState())
humrp.Parent.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Running, false)
humrp.Parent.Humanoid:SetStateEnabled(Enum.HumanoidStateType.RunningNoPhysics, false)
humrp.Parent.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Climbing, false)
humrp.Parent.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Freefall, false)
humrp.Parent.Humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, false)
humrp.Parent.Humanoid:SetStateEnabled(Enum.HumanoidStateType.FallingDown, false)
humrp.Parent.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Swimming, false)
humrp.Parent.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Flying, false)
humrp.Parent.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Landed, false)
humrp.Parent.Humanoid:SetStateEnabled(Enum.HumanoidStateType.StrafingNoPhysics, false)
humrp.Parent.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Seated, false)
KnockHandler.Move(humrp.Parent.Humanoid, 5000, 10, direction, 0.2, "Moving")
end
Originally I only set the Enum.HumanoidStateType.Running to false, however this didn’t work so I basically raged and tried setting every humanoid state type except for Physics/Ragdoll to false.
Needless to say, the HumanoidStateType continues to say “Running” despite it literally being disabled. This is in a server-sided module script.
I need to know how to keep this from happening. Why is this being overriden, and how do I stop it?