Matchmaking article not up to standard: require code updates for server creation

https://developer.roblox.com/en-us/articles/Matchmaking

I’ve seen the code from this article appear in at least one support question and the article itself being recommended in another. So it’s time to address the issue in the room: the outdated method of creating a private server for matchmaking.

The main point to address is the lobby script. In the startGame function, it uses the CreatePlace API to start a new server.

local arenaPlaceId = game:GetService("AssetService"):CreatePlaceAsync(
		"Arena place for " .. playerA.Name .. " and " .. playerB.Name, arenaPlaceTemplateId)

Since the advent of reserved servers, using the CreatePlace API to create new servers is outdated and heavily discouraged. CreatePlace involves the creation of entire new assets while ReserveServer issues a no-cost server instance that can be teleported to outside of automatic Roblox matchmaking.

I recently helped a user with an issue they were having and it involved the code from this article. During that, I managed to flatten a whole 23 or so lines of code to 3 or less. Everything from line 111 to 134 of the final Lobby script can be replaced with this simple code:

-- Note: I recovered this directly from the help thread.
-- Code modifications may need to be made later, rather than used raw.
local serverAccessCode = teleportService:ReserveServer(arenaPlaceTemplateId)
local playersToTeleport = {playerA, playerB}

teleportService:TeleportToPrivateServer(arenaPlaceTemplateId, serverAccessCode, playersToTeleport)

Matchmaking is becoming a big part of Roblox games and in fact has been for quite some time. Beginners are also looking to start up into matchmaking and have this article as their best reference since often they’re told to search for solutions before asking. Therefore, it’s important to provide such developers with the newest and most updated information for their convenience and learning path.

4 Likes

Hey there! I definitely agree that this article could use a good modernization. I will see what I can do to get this prioritized, especially since this is one of Roblox’s coolest features IMO. In the meantime, we may have to take down the page since it actively recommends bad practice (eg CreatePlaceAsync), then put it back up once it is ship-shape.

5 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.