# Set Players Ready

By default, players need to ready up in order for the match to start.

{% hint style="info" %}
When enough players are present in the lobby a countdown timer will be started. When all players are ready, the lobby will fast forward the countdown time and transition into the `StartingMatch` state.
{% endhint %}

## Toggle Player Ready State

Whether a player is ready or not is handled by the `KronosLobbyPlayerState` class. You can toggle the ready state of the player, or set it directly. Both functions are exposed to blueprints. In most cases, all you have to do is call `TogglePlayerReady` on the local player state. The ready state of the player will replicate down to all other players.

If you are using the `KronosLobbyWidget` then you can use the `GetLocalPlayerState` function to access the local player state casted into the correct type. This widget also contains the `OnPlayerIsReadyStateChanged` event which is called when the local player's ready state is changed.

{% tabs %}
{% tab title="Blueprint" %}

<figure><img src="/files/nPW0GvXDAr6bFGhPF0W8" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="C++" %}

```cpp
#include "Lobby/KronosLobbyPlayerState.h"
```

```cpp
// Get the local player state.
AKronosLobbyPlayerState* PlayerState = GetLocalPlayerState();
if (PlayerState)
{
    // Toggle the ready state of the player.
    PlayerState->TogglePlayerIsReady();
}
```

{% endtab %}
{% endtabs %}


---

# 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://horizongames.gitbook.io/kronos-matchmaking/usage/lobby/set-players-ready.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.
