TeleportOptions
Optional input arguments to the TeleportService:TeleportAsync() function.
Memory category | Instances |
---|
Member index 5
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
- 573 Change ReturnType of SetTeleportData from void to null
- 553 Change Default of ShouldReserveServer from to false
- 486 Change ThreadSafety of ShouldReserveServer from ReadOnly to ReadSafe
- 486 Change ThreadSafety of ServerInstanceId from ReadOnly to ReadSafe
- 486 Change ThreadSafety of ReservedServerAccessCode from ReadOnly to ReadSafe
- 462 Change ThreadSafety of SetTeleportData from to Unsafe
- 462 Change ThreadSafety of GetTeleportData from to Unsafe
- 462 Change ThreadSafety of ShouldReserveServer from to ReadOnly
- 462 Change ThreadSafety of ServerInstanceId from to ReadOnly
- 462 Change ThreadSafety of ReservedServerAccessCode from to ReadOnly
- 458 Add SetTeleportData
- 458 Add GetTeleportData
- 458 Add ShouldReserveServer
- 458 Add ServerInstanceId
- 458 Add ReservedServerAccessCode
- 458 Add TeleportOptions
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.
Thread safety | Unsafe |
---|
History 2
- 462 Change ThreadSafety of GetTeleportData from to Unsafe
- 458 Add GetTeleportData
ReservedServerAccessCode
Type | Default | |
---|---|---|
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.
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | true |
History 3
- 486 Change ThreadSafety of ReservedServerAccessCode from ReadOnly to ReadSafe
- 462 Change ThreadSafety of ReservedServerAccessCode from to ReadOnly
- 458 Add ReservedServerAccessCode
ServerInstanceId
Type | Default | |
---|---|---|
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.
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | true |
History 3
- 486 Change ThreadSafety of ServerInstanceId from ReadOnly to ReadSafe
- 462 Change ThreadSafety of ServerInstanceId from to ReadOnly
- 458 Add ServerInstanceId
SetTeleportData
Parameters (1) | ||
---|---|---|
teleportData | Variant | |
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 |
|
This data could then be retrieved upon arrival using the GetLocalPlayerTeleportData() function as follows:
1 2 3 4 5 6 7 8 |
|
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.
Thread safety | Unsafe |
---|
History 3
- 573 Change ReturnType of SetTeleportData from void to null
- 462 Change ThreadSafety of SetTeleportData from to Unsafe
- 458 Add SetTeleportData
ShouldReserveServer
Type | Default | |
---|---|---|
bool | false |
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.
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | true |
History 4
- 553 Change Default of ShouldReserveServer from to false
- 486 Change ThreadSafety of ShouldReserveServer from ReadOnly to ReadSafe
- 462 Change ThreadSafety of ShouldReserveServer from to ReadOnly
- 458 Add ShouldReserveServer