How to detect if a player is afk?

How can I detect if a player has moved to another tab other than the Roblox Player? There’s a game that has this feature:

It immediately shows the afk sign as soon as I move to another tab and disappears once I re-open roblox.

1 Like

If you want to see when the player loses focus of the Roblox Player screen, then you can use this: UserInputService | Roblox Creator Documentation

6 Likes

https://developer.roblox.com/en-us/api-reference/event/Player/Idled

I prefer the Idled event for this, as even if the Roblox window is focused the Idled event will fire if the player does not perform any actions for some period of time.

3 Likes

I wanted the window effect, but thanks for this!