I’m trying to make an AI that, when moving, triggers an animation. I was told MoveDirection.Magnitude is the best way to go about this. However, when tested the MoveDirection.Magnitude stays at 0 (even when moving). Here’s my code:
game:GetService("RunService").Stepped:Connect(function()
if janitor.Zombie.MoveDirection.Magnitude == 0 then
idleAny:Play()
walkingAny:Stop()
footstepSound:Stop()
elseif janitor.Zombie.MoveDirection.Magnitude > 0 then
walkingAny:Play()
idleAny:Stop()
footstepSound:Play()
end
end)