How to Make a Server Creation System

I’d like to create a system where players can create a lobby that players can join in, and when the lobby has enough players, the host can teleport the group into a new server of a different place. I’m hoping to make it kind of like a Story Game lobby, but with GUIs and a host that choses when the game is started. Please help if you can.

5 Likes

You can have a module full of player lobbies and then do server sided checks along with remote events for player interaction.

1 Like

Thanks, but I’m looking for code samples. What I mainly need is help with the “Teleport Lobby” button and creating a new server in the designated place.

ppl are not going to create system for you though, most only will give examples on “How to Make a Server Creation System”.
check out messaging service, which suits this the best.

I’m not asking for a full script, just some functions and events written in a code sample to help me.

The main thing I’m thinking you’ll need for a “private” server teleport of another place is

To reserve the server

and then to teleport the group all at once is

if not wanting to reserve a server, but wanting to just teleport everyone to the same server then you can use

5 Likes

This can be handled entirely with the standard TeleportService.

local ts = game:GetService("TeleportService")
local placeId = 0000000 --Change this to your place id
local targetPlaceId = 111111 --Change this to your target place id

function teleport(playersMoving)
    local accessCode = ts:ReserveServer(placeId)
    ts:TeleportToPrivateServer(targetPlaceId,accessCode,playersMoving)
end
--"Players Moving" are an array of teleporting players
--Feel free to connect this function to any event or integrate with other code.
  1. The code makes a new private server. See this API.

  2. The code teleports an array of players to a place pre-determined by the “targetPlaceId” variable. Feel free to change the spawn location (fourth param), teleport data (fifth param) and custom loading ScreenGUI (sixth param) although these of course are all optional. See here for more.

8 Likes

There’s a new function that has been out to standardize all teleports which will shorten all of this code.
I will also update the above code just incase that method does get deprecated at some point.
Using the new method also requires it to be ran on the server which can be done by remotes and is recommended to secure the teleport data.

local teleportService = game:GetService("TeleportService")
local targetPlaceId = 111111 --Change this to your target place id

function teleport(playersMoving)
    local teleportOptions = Instance.new(“TeleportOptions”) -- Creates a TeleportOptions Instance
    teleportOptions.ShouldReserveServer = true -- Sets the TeleportOptions to reserve a server at the place for the playersMoving
    teleportService:TeleportAsync(targetPlaceId, playersMoving, teleportOptions) -- Teleports the place, players, and options selected above
end
--"Players Moving" is once again an array of teleporting players

Wanna dive deeper?
You can also read more upon the updated Learn Roblox: Teleporting Between Places Article. Which will take you through creating a module script for this method and also sending Teleport Data.
You may view the explanation of all the new TeleportOptions here.
You can also check out more on the new method here.

9 Likes