PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

GetLocalPlayerTeleportData

This function returns the teleportData the Players/LocalPlayer arrived into the place with. It can only be used on the client and can be called at any time.

For example, the following snippet would send the DataModel/PlaceId and DataModel/JobId in a dictionary:

local Players = game:GetService("Players")

local player = Players.LocalPlayer
local teleportData = {
    placeId = game.PlaceId,
    jobId = game.JobId
}
TeleportService:Teleport(placeId, player, teleportData)

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

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 function will return nil.

Note this function will not return teleportation settings set using TeleportService/SetTeleportSetting, to retrieve these settings use TeleportService/GetTeleportSetting.

Returns

Return Type Summary

The teleportData the Players/LocalPlayer arrived into the place with