# 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://b2-scripts.gitbook.io/help/free-product-guides/b2-afk-system/how-it-works.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
