This function retrieves a teleport setting saved using
TeleportService/SetTeleportSetting using the given key.
This method is intended for use on the client only and should not be used on the server.
Teleport settings are preserved across teleportations within the same game. This means data can be saved using
TeleportService/SetTeleportSetting in one place and retrieved using GetTeleportSetting in another place the user has been teleported to.
For example, in a game that allowed crouching you could save whether the user is currently crouching prior to teleporting as a teleport setting. This could then be retrieved in the destination place after the teleportation:
local TeleportService = game:GetService("TeleportService") local isCrouching = TeleportService:GetTeleportSetting("isCrouching")
If no teleport setting exists under the given key, this function will return nil.
Differences from GlobalDataStores
Although they share some similarities, there are some key differences between teleport settings and datastores:
GlobalDataStore/SetAsyncstores the data on Roblox servers whereas SetTeleportSetting stores the data locally
- Data stored in a
GlobalDataStoreis preserved after the user leaves the game universe whereas teleport settings are not
GlobalDataStore|GlobalDataStorescan only be accessed on the server, whereas teleport settings can only be accessed on the client
GlobalDataStore|GlobalDataStoreshave usage limits, whereas teleport settings do not
In general teleport settings should be used to preserve client side information within a single play session across different places in a game.
GlobalDataStore|GlobalDataStores should be used to save important player data that needs to be accessed across player sessions.
Teleport settings and security
As teleport settings are stored locally, it is possible they can be manipulated by malicious users. This risk can be mitigated by employing server side validation, for more information on this please see the article on
This service does not work during playtesting in Roblox Studio — To test aspects of your game using it, you must publish the game and play it in the Roblox application.
The key the value was stored under using
The value stored under the given key