---
title: Private Room 런타임에서 세팅하기
slug: world-sdk-guide-kr/private-room
docTags: 
createdAt: 2024-09-02T08:34:13.135Z
---

런타임에 멀티플레이어 방 속성을 변경할 수 있습니다.

:::hint{type="danger"}
- 서버 코드 index.ts Sandbox를 생성해 주세요.
:::



## 함수 정의

| &#x20;                                    |                                              |
| ----------------------------------------- | -------------------------------------------- |
| SetPrivate(isPrivate : boolean) : Promise | - True : 비공개 방으로 설정<br />- False : 공개 방으로 설정 |

:::hint{type="info"}
**📘&#x20;**&#xB2E4;음 가이드를 참조하십시오. \[[ZEPETO.Multiplay(Server) API](https://developer.zepeto.me/docs/multiplay-server/classes/ZEPETO_Multiplay.Sandbox#setprivate)]
:::

## 사용 예시

```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"}
**👍 잠금 기능과 비공식 기능의 차이**

잠긴 멀티플레이어 방은 ZEPETO 방 목록에 표시되지 않으며 초대 없이 들어갈 수 없습니다.

- 비공식 멀티플레이어 방은 ZEPETO 방 목록에 표시되지 않지만 초대는 가능합니다.
:::

