So I’m trying to create my matchmaking system. When a player joins the game, I’m looking to put them in their own server which will be the “lobby”, where random people won’t be added. They can invite friends to their lobby or not, with a max of 4 players total. Once ready, they can start a game and if they don’t have 4, it will pair them up with others in a queue to make 4 and then teleport all 4 to another server to play the game. Think Fortnite/COD type system. How can I structure a server system as such? If I instantly transfer a player to a reserved lobby server, would their friends be able to join them if invited? And then maybe once they click “start”, it would transfer everyone to a queue server with others looking to be matched up before transferring those 4 to the game. Is there a better way to do this? Or would this even work?
Hello ![]()
A couple of things
For starters please structure your question better i can barely reed it ![]()
Second i think this might help: How to make a queue UI?
Good luck ![]()
I’ll be breaking up your post for readability:
I believe you’re looking for TeleportService; in particular, TeleportService:ReserveServer() and TeleportService:TeleportAsync(). When you matchmake a group of players, you can reserve a server, then use that reserved code to teleport that group.
No players are able to join the reserved server outside of TeleportAsync() IIRC, hence why it’s called a “reserved” server. It’d look something like this:
-- First, create a TeleportOptions instance for matchmaking
-- https://create.roblox.com/docs/reference/engine/classes/TeleportOptions
local TELEPORT_OPTIONS: TeleportOptions = Instance.new("TeleportOptions")
-- You want a private server for your parties, so set ShouldReservedServer to true.
-- I believe this will automatically allocate a reserved server ID for a teleported party
TELEPORT_OPTIONS.ShouldReserveServer = true
local function TeleportParty(party: { Player }): ()
-- Teleport your group of players
-- I specified the result here just so you know it returns something;
-- you can use this to see the reserved server ID
local result: TeleportAsyncResult = TeleportService:TeleportAsync(
PLACE_ID, -- This is the place that your party will teleport to
party,
TELEPORT_OPTIONS
)
end
I do not believe TeleportAsync will throw an exception if the players fail to teleport; that’s what TeleportService.TeleportInitFailed is for.