How can I create private servers in my game?

Hi, so I have a game where when a player joins they’re loaded into the lobby right. Then they can talk to an NPC in order to go through the process of teleporting to a “PVP” server. However, the issue i’m facing is how can I implement that “PVP” server? Would I have to create a reserve server with the player or?
For example:

Player 1 Joins, → Go to NPC → Start Teleport → (Is it possible to search for reserved servers and if they’re full?) → (If reserved server is full then start a new reserve server, else teleport to a free-space reserved server).

Example of this: (You see how I’m in the lobby, then i can also check for other available “Pro Servers”, how can one achieve this affect?)

Is this the correct flow for me to take or can someone correct me

1 Like

I’d appreciate it if anyone could help

Just use ReserveServer then use a DataStore or MessagingService to replicate all of the currently active servers. You can just save / transmit the PrivateServerId for each ReservedServer created, and then when anyone joins / leaves you broadcast the new player count.

This might help TeleportService:TeleportToPrivateServer.

Thank you very much, I humbly ask, how do I establish/lay out the servers though (as in the gif above), would i have to like create 5 reserved servers as soon as the first server is started and like make a global debounce so no more servers are generated if debounce is true (e.g. 5 server been created)?

Ty, do you mind telling me how I can do about using this (i’d appreciate if you could give examples please, especially in my case/scenario)

Sure thing! Here is an example:

local TeleportService = game:GetService("TeleportService")
local PlayersToTeleport = {}

TeleportService:TeleportToPrivateServer(00000000, TeleportService:ReserveServer, PlayersToTeleport)

Replace the 00000000 with the place ID. The PlayersToTeleport is an array containing the players to teleport.