How to use a reserved server with TeleportPartyAsync?

How would I go about teleporting players using teleportPartyAsync using a reserved server code?

Any help is appreciated.

1 Like

In the simplest way possible: You don’t.

Instead, you can use TeleportToPrivateServer as outlined here:

An example has been provided by Roblox in that linked documentation, hope this helps.

-- Credits: Roblox
local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")

local code = TeleportService:ReserveServer(game.PlaceId)

local players = Players:GetPlayers()

TeleportService:TeleportToPrivateServer(game.PlaceId, code, players)
-- You could add extra arguments to this function: spawnName, teleportData and customLoadingScreen

But in my experience, using that caused this annoying “Attempted to teleport to restrcited place” teleport error, so does teleportAsync.

Typically, you need to test this in a live demonstration through the use of the normal Roblox player. If a place is set to private irregardless studio will not want to teleport to it.

You have to remember:

Studio is not a substitute for the game client, studio is a tool for building and testing a place instance.

Inevitably studio is not a game client, and it does not understand what you want when you ask to teleport across the universe.

You have to think of it like this:

  • Studio is a building tool.
  • Studio only knows about the specified place which is open in that Studio tab
  • Studio can import things to that studio tab where possible, however even then it cannot import things without a proper connection.
  • Studio doesn’t know how to remain open when you teleport across games, if it did then their would be risks.
  • Studio cannot let you teleport to games outside that PlaceID, if it did then you could edit your character in the studio editor freely.
  • When you ask studio to teleport to a game outside of that studio tab, it will simply say "I do not have the data to actually find, create or get to that place - therefore I must refuse to teleport*.

Therefore if you wish to test it, you must play test it in the Roblox client. This is outlined in the documentation as Studio Limitation which can be searched here.

The error occurs outside of studio.

See this: