# Replay: kind() method

> The kind() method of the Replay interface returns a recorded entity kind by name, for kinds that changed since the recording.

The **`kind()`** method of the [`Replay`](/docs/client/replay) interface returns one of the replay's entity kinds by name, for a kind whose fields changed since the replay was recorded.

## Syntax

```ts
kind(name)
```

### Parameters

`name`
: A string: the kind's name, as `entity()` declared it.

### Return value

The kind, or `undefined` if the replay has no kind of that name.

### Exceptions

None.

## Description

With the `schema` passed to [`loadReplay()`](/docs/client/loadreplay), a recorded kind with the same fields as the schema's is the schema's own kind object, so `replay.entities.all(Ball)` finds its entities. A kind you've changed since is read from the replay's header instead, as a kind object of its own, and `all()` with your current kind finds nothing. `kind()` returns the replay's kind of that name, which is your own kind when its fields match and the recorded one when they don't, to pass to the [`entities`](/docs/client/replay/entities) store's methods.

Its entities' fields are the recorded ones, so read them by the names the recording had.

## Examples

### Playing a replay recorded before a field was added

A game added a `spin` field to its ball after some replays were recorded. The viewer looks the kind up by name, so it finds the balls of old and new replays alike.

```ts
// old-replays.ts
import { defineSchema, entity } from "@irtio/client";
import type { Replay } from "@irtio/client/replay";

export const Ball = entity("ball", { x: "f32", y: "f32", spin: "f32" });
export const schema = defineSchema({ entities: [Ball] });

export function ballPositions(replay: Replay): { x: number; y: number }[] {
  const kind = replay.kind("ball") ?? Ball;
  return [...replay.entities.all(kind)].map((b) => {
    const { x, y } = b.toJSON() as unknown as { x: number; y: number };
    return { x, y };
  });
}
```

## See also

- [`loadReplay()`](/docs/client/loadreplay)
- [`Replay.entities`](/docs/client/replay/entities)
- [Playing back](/docs/room/guides/replays#playing-back) in Replays and clips
