> For the complete documentation index, see [llms.txt](https://b2-scripts.gitbook.io/help/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://b2-scripts.gitbook.io/help/free-product-guides/b2-afk-system/how-it-works.md).

# How it works!

### How It Works

#### Client-side

The client-side script (`client.lua`) continuously monitors player activity. It checks for:

* Movement controls
* Walking, running, or sprinting
* Camera rotation (mouse movement)

If no activity is detected for the duration specified in `Config.IdleTimeThreshold`, the player is marked as AFK.

#### Server-side

The server-side script (`server.lua`) manages the AFK states of all players. It:

* Receives AFK notifications from clients
* Manages the list of AFK players
* Handles the kicking of AFK players (if enabled)
* Checks for admin/mod exemptions

#### AFK Visual Indicator

When a player is AFK, a 3D "AFK" text appears above their character, visible to all players.
