Ever wondered how to send data between places? For example in a game that uses a seperate place for the lobby and the map? I will be showing you a very simple way! As well as the method to set a custom teleport GUI to replace the default roblox “Placename” teleport.
Firstly, we import the TeleportService
local TeleportService = game:GetService("TeleportService")
Next we just define the teleport data that we need.
TeleportService:SetTeleportSetting("ValueName", Value)
And then in the arrival place, you just do this in a localscript:
local teleportData = TeleportService:GetLocalPlayerTeleportData()
This will print all the data in a table, otherwise to set a specific value you do the following
local Valuename = TeleportService:GetTeleportSetting("ValueName")
As for setting a custom teleport UI, it’s as simple as this:
TeleportService:SetTeleportGui(heregoesyourGUI)
Make sure your heregoesyourGUI variable is a path to the teleportGUI you need.
Difference between teleport settings and datastores: (From Roblox Documentation)
GlobalDataStore:SetAsync() stores the data on Roblox servers whereas SetTeleportSetting stores the data locally
Data stored in a GlobalDataStore is preserved after the user leaves the game universe whereas teleport settings are not
GlobalDataStores can only be accessed on the server, whereas teleport settings can only be accessed on the client
GlobalDataStores have 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. GlobalDataStores should be used to save important player data that needs to be accessed across player sessions.](TeleportService | Documentation - Roblox Creator Hub)
This is my first informational post on the dev forum, hope it helps someone!