---
title: Setting in Private Room runtime
slug: world-sdk-guide/setting-in-private-room-runtime
docTags: 
createdAt: 2024-09-02T08:34:13.135Z
---

You can change the multiplayer Room attribute at runtime.

:::hint{type="danger"}
- Please create the server code index.ts Sandbox.
:::



## Function definition

|                                           |                                                                |
| ----------------------------------------- | -------------------------------------------------------------- |
| SetPrivate(isPrivate : boolean) : Promise | - True : Set to private room<br />- False : Set to public room |

:::hint{type="info"}
**📘&#x20;**&#x50;lease refer to the following guide. \[[ZEPETO.Multiplay(Server) API](https://developer.zepeto.me/docs/multiplay-server/classes/ZEPETO_Multiplay.Sandbox#setprivate)]
:::

## Example of use

```typescript
import { Sandbox, SandboxOptions, SandboxPlayer } from 'ZEPETO.Multiplay';

export default class extends Sandbox {
    
    onCreate(options: SandboxOptions) {
        this.onMessage("SetPrivate", (client: SandboxPlayer, value: boolean) => {
            console.log(`Try Set Private : ${value}`);
            this.SetPrivateRoom(client, value);
        });
    }
    
    async SetPrivateRoom(client: SandboxPlayer, value: boolean) {
        await this.setPrivate(value);
        client.send("Log", `Room Set Private : ${this.private}`);
    }
}
```

:::hint{type="success"}
**👍 Difference between lock and private functions**

The locked multiplayer room is not visible in the ZEPETO room list and cannot be entered by invitation.

- Private multiplayer rooms are not shown in the list of ZEPETO rooms, but invitations are acceptable.
:::

