How do I teleport players to the same Reserved Server?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    Hello! I’m making a global matchmaking system.
  2. What is the issue? Include screenshots / videos if possible!
    The issue is that it’s not teleporting both players to the same reserved server. The root of the problem is that when both servers get notified of the publishasync, then they both come up with a different code. If anyone could give me any ideas for only one server to come up with a code for every server then that would be great!
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I’ve tried to look on the developer forum, haven’t found anything that helps my problem. I’ve tried to add a debounce, and of course that did not work.
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

Edit: I can’t add multiple players in the player list because getting player objects in another server returns nil.

maybe you could show the other script? that is, the one that teleports the players

I do not think the script will help as I’m just looking for a way for only one server to come up with a reserved code. But, sure:


Here is some previous Developer forum topics that can explain / help you with what you need.

Thank you for these resources, but these do not help me with my problem. Their mostly about teleporting the players in the same server, which will ultimately give the same access code because it’s the same server. But I’m working with different servers that will both come with different reserved codes.

This is my code (it’s not fully complete, I just need help with this part):

local server = game:GetService(“ServerScriptService”)
local teleporter = server.Teleporter
local misc = server.Misc
local playerlist = teleporter.Playerlist
local matchmaker = server.Matchmaker
local reservedServers = misc.ReservedServers
local debounce = false

if debounce == false then
debounce = true
local humanoid = player.Character.Humanoid
humanoid.WalkSpeed = 0
humanoid.JumpPower = 0
local teleporter = reservedServers:GetChildren()[1]
print("teleporter: "…teleporter)
debounce = false

if debounce == false then
debounce = true
local teleporter = reservedServers:GetChildren()[1]
print("teleporter: "…teleporter)
local code = teleporter:InvokeServer()
print("code: "…code)
playerlist.Value = code
debounce = false

local teleportService = game:GetService(“TeleportService”)
teleportService:TeleportToPlaceInstance(game.PlaceId, reservedServers:GetChildren()[1].Code, player)

You need to use a mutex for this.
This article explains it pretty well:
There are also some questions on the devforum you can use to help guide you: