How can I use TeleportationAsync to make private lobbies?

Greetings,

I have looked at the article called Teleporting Between Places and I have seen something that I have needed for a very long time. I have seen that with the TeleportationAsync function, players can teleport to specific servers. I need something for a lobby though, like a party (there is a host, that makes the party and that is teleported to the private party server and is given a random code such as 8506, and players can connect with that code from the main game and teleport to the party server). Any ideas on how can I do that? Thanks!

1 Like

The host will generate a code using ReservePrivateServer. They will be teleported to the server and a key will be saved in a datastore which will be the code YOU generated, while the value will be the access code to the datastore.

When a player wants to join a host’s server, look through that datastore for the code they typed and if one is found, grab the value inside and teleport

2 Likes

You can actually try to make something like this:

local TeleportService = game:GetService("TeleportService")
local placeid = 0123456789 -- replace this with your place id

If you want to make it like, a player presses on a button that teleports every player in that lobby, here’s how it could look like:

local TeleportService = game:GetService("TeleportService")
local list = {} -- the player list
local placeid = 0123456789 -- replace this with your place id
local TeleportEvent = game.ReplicatedStorage.TeleportEvent -- add a RemoteEvent in ReplicatedStorage and name it "TeleportEvent"

TeleportEvent.OnServerEvent:Connect(function()
    local reserve = TeleportService:ReserveServer(placeid)
    print("Teleporting!")	
    TeleportService:TeleportToPrivateServer(place,reserve,list)
end)

I found a very useful tutorial on YouTube, where you can see more details.
Here’s the link:

2 Likes

Thanks a lot! Is it possible to contact you, in case I meet any problems? Thank you once again for the fast and useful response, I really appreciate it!

1 Like

No problem! You can add me on Roblox so you can contact me anytime.

1 Like