# RoomClient: setLobbyReady() method

> The setLobbyReady() method of the RoomClient interface marks this player ready in a lobby, or not ready.

The **`setLobbyReady()`** method of the [`RoomClient`](/docs/client/room-client) interface marks this player ready in a lobby, or not ready. It's the lobby's call `ready`.

## Syntax

```ts
setLobbyReady(ready)
```

### Parameters

`ready`
: A boolean: `true` to mark this player ready, `false` to mark them not ready.

### Return value

A `Promise` that resolves with `undefined` once the lobby has taken the change.

### Exceptions

`IrtError`
: Rejects with this if the call fails. Its `name` says why:

  `OperationError`
  : The lobby is handing off, which its `reason` says. In a room that isn't a lobby, the room has no `ready` call to answer.

  `TimeoutError`
  : The lobby didn't answer within 10 seconds.

  `NetworkError`
  : The connection dropped before the answer, or the client is reconnecting.

  `InvalidStateError`
  : The client hasn't been ready yet, or it's closed.

## Description

A lobby is a room type with lobby settings in `irt.config.ts`; see [Lobbies and parties](/docs/room/guides/lobbies). [`room.lobby`](/docs/client/room-client/lobby) holds its state, with the ready players in `ready`, and the [`lobby` event](/docs/client/room-client/lobby-event) fires when it changes, including after `setLobbyReady()`.

A player's ready flag lasts as long as their last connection to the lobby. Under the `"allReady"` start rule, the countdown starts once every person is ready, and a player marking themselves not ready during the countdown stops it. Bots are always ready.

## Examples

### Toggling a ready button

The button marks the player ready or not ready, and its label follows the lobby's state.

```ts
// ready-button.ts
import { connect, IrtError } from "@irtio/client";

const room = await connect("lobby", { type: "lobby" });
const button = document.querySelector("#ready")!;

room.addEventListener("lobby", ({ detail }) => {
  button.textContent = detail.ready.includes(room.player) ? "Not ready" : "Ready";
});

button.addEventListener("click", async () => {
  const ready = !room.lobby?.ready.includes(room.player);
  try {
    await room.setLobbyReady(ready);
  } catch (e) {
    // Such as a lobby that's handing off, or a dropped connection
    if (e instanceof IrtError) console.warn(`Couldn't change ready: ${e.message}`);
    else throw e;
  }
});
```

## See also

- [`RoomClient.startCountdown()`](/docs/client/room-client/startcountdown)
- [`RoomClient.lobby`](/docs/client/room-client/lobby)
- [Lobbies and parties](/docs/room/guides/lobbies)
- [`<irt-lobby>`](/docs/client/ui-kit#irt-lobby), for a whole lobby screen
