# ShowAllClientsInRoom(room\_name  ) and callback\_ShowAllClientsInRoom()

## Description

This function tells you about all the clients in a room. Enter the room name you want to check for.

#### Syntax

```
ShowAllClientsInRoom(room_name);
```

| Argument    | Description                                                                 |
| ----------- | --------------------------------------------------------------------------- |
| `room_name` | <p>The name of the RNet room you want to scan.<br>This must be a String</p> |

#### Returns

```
N/A
```

## How do I see which clients are on this room

After a successful scan of the room name you entered, the callback function **callback\_ShowAllClientsInRoom()** is called. So under Scripts/Rocket Networking/Callback Functions , you can edit this to do whatever you want…

❓ This function returns an array of all client id’s in a room. For example if there are 3 clients with clientId’s 3, 6 and 11 respectively in the room “public”, this function’s callback will return the array \[ “3” , “6” , “11” ] . It is worth noting that these are not numbers in the array, they are strings of the numbers.

### Example Implementation of function call

* So firstly I made 2 clients join the room “public”
* Then I wrote some basic code to try out this function

<figure><img src="https://1224219250-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvYO9I4EKmgDF783aI7J4%2Fuploads%2FmyQRonk1X5gjW0KR1PdK%2Fimage.png?alt=media&#x26;token=fd87c3aa-4da2-49ce-9ee0-a34efd51f6b3" alt=""><figcaption></figcaption></figure>

### Example Implementation of callback(continued)

* Then after I pressed okay, this callback code took place
* Here I’ve just done a show\_message so the user is shown a dialog box with that message but you get the idea

<figure><img src="https://1224219250-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvYO9I4EKmgDF783aI7J4%2Fuploads%2F0R9sUjCAhkTtIJQ4tjAw%2Fimage.png?alt=media&#x26;token=df84a2e8-315e-4cb9-ba53-5640cbba8522" alt=""><figcaption></figcaption></figure>

* So what it returned in the end was

```
[7,9]in public
```

## If the room does not exist?

&#x20;⚠️ If the room you entered does not exist, this callback function will not return an array. **Instead the “array\_of\_clients” variable will be the integer -1.** So a good practice would be to first check if it is an array. If not then the room doesn’t exist. If yes then treat it as an array.
