Reserving a server for multiple people from different server?

Using the MessagingService, I’m making a cross server matchmaking system that also includes season ranking. The way this works is that there’s a table for all the rankings, and once a player queues, they’re added to the table in all servers, along with their information in the following format:

{{Player1 Id, Info},{Player2 Id, Info}}

After the matchmaking has a sufficient number, I want to transport them all to the same reserved server. I vaguely know about TeleportService but I’m not sure how to secure a server and transport them all directly there

2 Likes

Everything you need for that can be found in TeleportService:ReserveServer() and in TeleportService:TeleportToPrivateServer()

EDIT: If you need assistance with regards to these, you can either reply here or DM me.

2 Likes

Actually, I’ve visited both of those articles a few times, and this post has kind of become my last resort.

1 Like

Ok, for your case, we’ll use the code at the bottom of the article: https://gyazo.com/8fddf88930404bb54eaed603dec562ca

You’ll want to iterate through your matchmaking table instead of Players:GetPlayers() as shown in the article. Then you’ll want to teleport that list of players to the reserved server you’ll have created.

TeleportService:ReserveServer() returns the reserved server id for you to use in the teleporting.

4 Likes

Thanks! Would that mean I have to send that one code to all the servers? Meaning 2 messages would have to be sent in the matchmaking?

1 Like

Yes, unless you have one script handling all of the matchmaking.

EDIT: Check out Roblox’s roadmap for game scripts in the future. You’ll want to keep an eye on that.

1 Like

Currently, I do.
The way the script works is that if there’s a certain number of people in a matchmaking, it’s supposed to reserve a server. But if it reserves a server once the queue is made full, wont I need to send that code to all the other members of the queue?

1 Like

If everyone is in their own server, you will have to, yes.

2 Likes

hi again, I know you’d solved this problem yesterday, but I was wondering if there was a way to leave the “SpawnName” parameter blank? I have teleport data to send, but I dont have a specific place for them to spawn

The SpawName parameter shouldn’t be nil (if that is what you meant by blank), but if you meant by “” then that’ll work for example:

local TS = game:GetService("TeleportService")
TS:TeleportToPlaceInstance(placeId,instanceId,Plr,"",{ --[[teleport data goes in the table]] },LoadingScreen)
1 Like

It I set it to “”, will they just spawn in the default spawn place in the world?

1 Like

Yep it will do just that. (30 character limit RIP)

2 Likes