# RoomClient: playerData property

> The playerData read-only property of the RoomClient interface is the player's data, kept across every room of the project.

The **`playerData`** read-only property of the [`RoomClient`](/docs/client/room-client) interface is the data of the player the client connected as, kept across every room of the project.

## Value

A [`PlayerData`](/docs/room/player-data) for this player, as [`dataClient()`](/docs/client/dataclient) gives it, made with the client's token or guest.

## Description

Its calls go over the router's HTTP API, not the room connection, so they work while the client reconnects and before it's ready. Nothing is cached on the client; every call goes to the router.

A client reads its own player data, and writes only the keys the project's `data.player.clientWrite` lists. Its writes can't use `once`, and `refresh()` has nothing to drop. Calls reject with a [`DataError`](/docs/room/data-error): `E_UNAVAILABLE` when the router or data service can't be reached, `E_LIMIT` over the router's 10 calls a second per address and per player, `E_FORBIDDEN` for a key the client can't write or a rejected token, and `E_INVALID` for a write with `once`.

## Examples

### Saving the player's settings

A settings menu saves the player's volume to player data and loads it back. Saving returns `false` when the data service can't be reached.

```ts
// settings.ts
import { connect, DataError } from "@irtio/client";

const room = await connect("main");

export async function saveVolume(volume: number): Promise<boolean> {
  try {
    await room.playerData.set("settings", { volume });
    return true;
  } catch (e) {
    if (e instanceof DataError && e.code === "E_UNAVAILABLE") return false;
    throw e;
  }
}

export async function loadVolume(): Promise<number> {
  const saved = await room.playerData.get<{ volume: number }>("settings");
  return saved?.value.volume ?? 1;
}
```

## See also

- [`dataClient()`](/docs/client/dataclient)
- [`RoomClient.collection()`](/docs/client/room-client/collection)
- [Player data, collections and leaderboards](/docs/room/guides/player-data)
