Reference API Roblox

Engine API

Website

Related

Reference API Roblox

TeleportOptions

Optional input arguments to the TeleportService:TeleportAsync() function.

Member index 5

HistoryMember
486ReservedServerAccessCode: string
486ServerInstanceId: string
553ShouldReserveServer: bool
462GetTeleportData(): Variant
573SetTeleportData(teleportData: Variant): null
inherited from Instance
553Archivable: bool
635Capabilities: SecurityCapabilities
553Name: string
553Parent: Instance
635Sandboxed: bool
616UniqueId: UniqueId
576AddTag(tag: string): null
573ClearAllChildren(): null
462Clone(): Instance
573Destroy(): null
486FindFirstAncestor(name: string): Instance
486FindFirstAncestorOfClass(className: string): Instance
486FindFirstAncestorWhichIsA(className: string): Instance
486FindFirstChild(name: string, recursive: bool = false): Instance
486FindFirstChildOfClass(className: string): Instance
486FindFirstChildWhichIsA(className: string, recursive: bool = false): Instance
486FindFirstDescendant(name: string): Instance
563GetActor(): Actor
486GetAttribute(attribute: string): Variant
462GetAttributeChangedSignal(attribute: string): RBXScriptSignal
631GetAttributes(): Dictionary
648GetChildren(): Instances
462GetDebugId(scopeLength: int = 4): string
486GetDescendants(): Array
486GetFullName(): string
641GetStyled(name: string): Variant
576GetTags(): Array
576HasTag(tag: string): bool
486IsAncestorOf(descendant: Instance): bool
486IsDescendantOf(ancestor: Instance): bool
580IsPropertyModified(name: string): bool
573Remove(): null
576RemoveTag(tag: string): null
580ResetPropertyToDefault(name: string): null
573SetAttribute(attribute: string, value: Variant): null
462WaitForChild(childName: string, timeOut: double): Instance
648children(): Instances
553clone(): Instance
573destroy(): null
553findFirstChild(name: string, recursive: bool = false): Instance
648getChildren(): Instances
553isDescendantOf(ancestor: Instance): bool
573remove(): null
462AncestryChanged(child: Instance, parent: Instance)
462AttributeChanged(attribute: string)
462ChildAdded(child: Instance)
462ChildRemoved(child: Instance)
462DescendantAdded(descendant: Instance)
462DescendantRemoving(descendant: Instance)
500Destroying()
553childAdded(child: Instance)
inherited from Object
647ClassName: string
647className: string
647GetPropertyChangedSignal(property: string): RBXScriptSignal
647IsA(className: string): bool
650isA(className: string): bool
647Changed(property: string)

Description

This class is an optional parameter to the TeleportService:TeleportAsync() function that allows developers to provide arguments for the teleport call.

Certain arguments in this class are not compatible with each other and cause an error when passed to TeleportService:TeleportAsync():

  • ReservedServerAccessCode + ServerInstanceId
  • ShouldReserveServer + ServerInstanceId
  • ShouldReserveServer + ReservedServerAccessCode

For more information on how to teleport players between servers, see Teleporting Between Places.

History 16

Members 5

GetTeleportData

Parameters (0)
No parameters.
Returns (1)
Variant

This function returns the teleport data stored in the TeleportOptions instance by TeleportOptions:SetTeleportData().

Once a player has teleported, teleport data can be retrieved using the Player:GetJoinData() and TeleportService:GetLocalPlayerTeleportData() functions.

For more information on how to teleport players between servers, see Teleporting Between Places.

History 2

ReservedServerAccessCode

TypeDefault
string

This property indicates the reserved server access code for the reserved server that the user(s) should be teleported to.

For more information on how to teleport players between servers, see Teleporting Between Places.

History 3

ServerInstanceId

TypeDefault
string

This property indicates the DataModel.JobId of the server instance the user(s) should be teleported to.

For more information on how to teleport players between servers, see Teleporting Between Places.

History 3

SetTeleportData

Parameters (1)
teleportDataVariant
Returns (1)
null

This is a setter function for data to be passed to the destination place. On the destination place, this data can be retrieved using Player:GetJoinData() or TeleportService:GetLocalPlayerTeleportData().

For example, the following snippet would send the DataModel.PlaceId and DataModel.JobId in a dictionary passing the teleport data in a TeleportOptions instance using TeleportOptions:SetTeleportData():

1
2
3
4
5
6
7
8
-- Server
local teleportOptions = Instance.new("TeleportOptions")
local teleportData = {
    placeId = game.PlaceId,
    jobId = game.JobId
}
teleportOptions:SetTeleportData(teleportData)
TeleportService:TeleportAsync(game.PlaceId, {player}, teleportOptions)

This data could then be retrieved upon arrival using the GetLocalPlayerTeleportData() function as follows:

1
2
3
4
5
6
7
8
-- Client
local TeleportService = game:GetService("TeleportService")

local teleportData = TeleportService:GetLocalPlayerTeleportData()
if teleportData then
    local placeId = teleportData.placeId
    local jobId = teleportData.JobId
end

If no teleportData was set in the teleportation function this GetLocalPlayerTeleportData() will return nil.

For more information on how to send and receive user data along with teleports, see, see Teleporting Between Places.

History 3

ShouldReserveServer

TypeDefault
boolfalse

This property indicates whether the teleport call should create a new reserved server. When set to true, a reserved server will be created and the player(s) will be teleported to the new server.

If set to false, the player(s) will be teleported to the public server with the specified TeleportOptions.ServerInstanceId if provided. When TeleportOptions.ServerInstanceId is blank or no matching server is found, a new public server will be created to teleport the player(s) to.

For more information on how to teleport players between servers, see Teleporting Between Places.

History 4

Settings