Humanoid.Running works occasionally

When the ais stop moving, the idle animation should play. Which it does sometimes, it seems to be glitched sometimes in the running event.
gif:
https://gyazo.com/f667c3bfbedbb379560def76359ef968

Code:

humanoid.Running:Connect(function(speed)
	if speed > 0 then 
		MoveAnimation(ai,trackanimationmove)
	else
		dleAnimation(ai,trackanimationidle)
	end
end)

Instead of using Humanoid.Runninng, you could just manually apply the animation when they are told to reach the destination and when they’ve reached it stop the animation.

If you’re using MoveTo then you can use the MoveToFinished event.

The animations are client sided, while the server side handles the moveTo events.

Use a BoolValue inside the NPC which is set true when they are meant to move and set false when they have reached the destination.

Then in the LocalScript you can connect on .Changed of the BoolValue, check if it’s true or false and play/stop the animation.

2 Likes

That’s a brilliant idea, I will try that out. Thank you.

1 Like

Works, thanks!
https://gyazo.com/bfd354366e3734a292150a470c630a81

2 Likes