Enum.HumanoidStateType.Idle

character
humanoid
enumeration

#1

If you look at the HumanoidStateType enum list you will see that there are quite a few HumanoidStateTypes; Running, Jumping, Swimming, Climbing, Seated, Landed, you name it. There are also a few odd ones like ‘RunningNoPhysics’ which - even more oddly - aren’t unused. Unfortunately though there doesn’t seem to be an ‘Idle’ state which in my opnion does belong to the core movement states. It is hard to find any game - outside of Roblox - where characters do not have an idle state (unless you’re looking in the ‘endless runner’ category). I find it a bit weird that there is no Idle state so I would love it if it could be added.

Of course ‘other games/engines have it so Roblox should add it’ and ‘it would make more sense’ are no valid arguments, so here is an actual list of reasons why I think developers would benefit from this addition:

  • An idle state would be great because it makes character animations easier to program; instead of running a loop on Heartbeat you can now listen to Humanoid.StateChanged and check if the new state is ‘Idle’ to stop the current running/walking animation.

  • An Idle state would be great since it synergizes well with the ContextActionService. Some games like to tie multiple actions to one button, but depending on your current movement the action is different. Zelda games for example tie the A button to the roll action. Rolling isn’t possible though when standing still. If I were to make something similar to that in Roblox and there were to be an Idle state for humanoids, I could now easily unbind the roll action when the character changes into the Idle state. Once the player transitions back into the Running state I can then rebind the action. The same goes for character moves in Super Smash Bross for example, where certain buttons make different actions happen depending on if you’re moving or standing still.

  • An Idle state would also be a nifty way to determine if a player is currently AFK. If the player changed into the Idle state but hasn’t changed to another state for a while, it is fair to assume that the player isn’t playing the game. This could be useful for round based games with an AFK system since you can then easily determine if a player shouldn’t take part in a round. Player hasn’t moved for over a minute? Set his game state to AFK so he doesn’t participate in the next round. It could also be used to remove players from rounds. In Deathrun for example we used to have a round timer to prevent stalemates, but often times the last player remaining would actually be AFK and force the game to take a minute longer than needed.

There are of course more reasons, but these are the ones that immediately came to mind. Let me know what you think about this suggestion or if anyone has other reasons why an Idle HumanoidStateType should be added let me know.


#2

If possible, maybe add Enum.HumanoidStateType.Treading (or TreadingWater to clarify) to signal when the player is idle in Terrain water, too? Just something I was thinking about a week ago, I’m having trouble trying to write my own “idle while in water” detector.


#3

Would also be useful, but perhaps named “SwimIdle” instead.


#4

Yeah, I remember looking at Humanoid States to see if I could use it to easily script animations, but there was no idle state.


#5

Why is this not a thing??

I was just writing a server-side animator component to make it easy to plug-and-play into a variety of NPCs. I wrote it using Humanoid.StateChanged but now I see that I need to find another way!? What??