Reserved Server

Hello! I need to create simple system i have

Lobby (Just gui, no models in there)

  • Main game

And i need to make something with private servers soo you can create your own server in lobby (it will be playing in Main Game you just create it in lobby) and then share code with friends to make them join your reserved server. Any idea how to make this work?

1 Like

Have you even tried any code yourself, and also we cannot just give you code

I´m not asking for code, i just need to know way to do it, i know there is some form of UUID of each server but i dont know how to connect players to it and check if it is correct (if that server exist)

Just look at the API reference on teleport service


I dont see there anything related to how to get server id and how to connect to server using ID

Also how to connect player to main game and create that server there, i can read API Documentation there is just nothing about this

Use this then:
TeleportService

But how to teleport player from Lobby to Main Game and from Main Game to Main Game Private:

Like this:

Lobby (Create server) > Teleports player into normal server > Before he even loads it creates private server and teleport him into it

You can use TeleportService:Teleport() to teleport a player to the main game and then in the main game use TeleportService:ReserveServer() to send the player to the private main game.

1 Like

Okay, then how to teleport players from lobby using ReservedServer UUID code (they enter it into textbox and hit join)

There are multiple ways to do that. I would prefer these two:

  1. Generating a code (like a password) which the player can put in the TextBox and the script will detect the code and send them to the wanted server.

  2. Using the given code when you create a reserved server which is long and can be difficult to use.

If you do it like the first method, you should use DataStoreService to save the code. You should use the code as the key since it will be easier to manage it.

I honestly dont understand this
I looped this for each play that had the server code that I randomly generated and it gave me the error, Can I not create my own codes?

if Command == "Start" then
game.Lighting.HostNumber.Value = game.Lighting.HostNumber.Value - 1
for i, Players in pairs(MyPartyData:GetChildren()) do
local Name = Players.Value
print(Name)
if Name ~= "" then
print(Name)
local Player = game.Players:FindFirstChild(Name)
local code = TS:ReserveServer(ServerCode.Value)
TS:TeleportToPrivateServer(game.PlaceId, code , Player)
end
end
end