How to Cap Players in a Server/Lobby

Hello!!!

In my game I have added a server system where people can join your server. Now, I want to cap the players on that server. So if you click on “1” There will be only one player in your lobby, which is yourself. And if you click on “2” there will be two players in your server, all the way to 5 max players.

How would you do that?

All help would be well appreciated! :grin:

image_2025-01-01_095336915

image_2025-01-01_095420882

The children in 5 are the same in 1, 2, 3 and 4. Also the ImageButton is the button that conrolls the amount of people that can go in a server/lobby.

Make a NumberValue and named it to “MaxPlayersValue”. And whenever someone tries to enter that server, create code that checks if the player count is above MaxPlayersValue when that player enters.

1 Like

I am away from my pc today but tommorow I can, will try tomorrow!!

I am now back to my pc! reply to this reply if you are here.

Also, do i make that numbervalue with a script or with explorer.