Humanoid:GetState() not returning the proper StateType?

Hello!

I’m trying to have the humanoid play an animation when a button is pressed and the humanoid is running.
In the 2nd spoiler, every print is me hitting Q.

This is my code

image

This is the result

Image from Gyazo

Am I using :GetState() correctly?
If I am, then why is this so inconsistent?
It should only print “no” if the player isn’t running, but it still prints this regardless of the fact that it’s running or not.

I would love to get some advice.
Thanks in advance.

1 Like

There are actually two humanoidstatetypes for running. Running & RunningNoPhysics.

Sauce: Documentation - Roblox Creator Hub

2 Likes

If you want to eliminate the condition of also “standing in place”, then you should probably connect to humanoid.Running and check if the argument (speed) passed to it is greater than 0.1 or not.

2 Likes

This seems way more reliable than using StateTypes, thanks!

If checking the humanoid’s state doesn’t work,
in what scenarios should I be checking for the humanoid’s state instead?

It’s perfectly reasonable to check the humanoid states for most things. Jumping and landing is a good example.

1 Like