---
title: Set Game Rule
description: "Play 0x39, client → server."
---

`play` · `0x39` · **serverbound** (client → server)

Requests a game rule change from the in-game game rule editing screen. It identifies the `gameRule` and its new `value`. The server applies it only if the player has permission for the `/gamerule` command.

Sent by the client, read by the server. Listen for it with `client.on("SetGameRule", (data) => …)` on the receiving side.

## Fields

| Field | Type | Notes |
|---|---|---|
| `rules` | Array |  |

## Send it

```ts
await client.sendPacket("SetGameRule", {
  rules: /* Array */,
});
```

Field aliases listed under Notes are accepted as alternative keys when writing.

Source: [`src/Core/Versions/776/Packets/play/serverbound/SetGameRule.ts`](https://github.com/GDLev/mc-protocol/blob/master/src/Core/Versions/776/Packets/play/serverbound/SetGameRule.ts)
