Collapse Sidebar


This function returns the DataModel/PlaceId|PlaceId and DataModel/JobId|JobId of the server the user with the given Player/UserId|UserId is in, provided it is in the same game as the current place.

Then, TeleportService/TeleportToPlaceInstance can be called with this information to allow a user to join the target user’s server.

Upon a successful lookup, the function returns the following values:

# Name Type Description
1 currentInstance bool A bool indicating if the user was found in the current instance
2 error string An error message in the event of the lookup failing
3 placeId int64 The PlaceId of the server the user is in
4 instanceId string The JobId of the server the user is in

If there is a problem during lookup, such as the user being offline, an error is thrown. It is recommended that you wrap calls to this function in pcall.


You should be aware of the following limitations when using this function:

  • This function can only be called by the server
  • This function may fail to return the correct information if the user is teleporting
  • It is possible for this function to throw an error, hence developers should wrap it in a pcall (see example below)
  • As this function returns the JobId of the server and not the access code returned by TeleportService/ReserveServer, the id returned is not appropriate for use with reserved servers

Studio limitation

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.

See also

  • For the DataModel/PlaceId|PlaceIds and DataModel/JobId|JobIds of a Player|Player’s friends, use Player/GetFriendsOnline


Name Type Default Description

The Player/UserId of the Player


Return Type Summary

See the table above

Code Samples

Following Another Player

The code sample below, when placed inside a Script within ServerScriptService, will teleport a player who’s following another player to the associated place/server. Note that this will not work if the player being followed is in a reserved server.

-- Client
local TeleportService = game:GetService("TeleportService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")

local TeleportEvent = ReplicatedStorage:WaitForChild("TeleportEvent")

	-- Is this player following anyone?
	local followId = player.FollowUserId
	-- If so, find out where they are
	if followId and followId ~= 0 then
		local success, errorMessage = pcall(function()
			-- followId is the user ID of the player that you want to retrieve the place and job ID for
			currentInstance, _, placeId, jobId = TeleportService:GetPlayerPlaceInstanceAsync(followId)
		if success then
			local teleportOptions = Instance.new("TeleportOptions")
			teleportOptions.ServerInstanceId = jobId

			-- Fire teleport event to teleport player on server
			TeleportEvent:FireServer(placeId, teleportOptions)
		warn("Player " .. player.UserId .. " is not following another player!")
-- Server

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TeleportService = game:GetService("TeleportService")

local TeleportEvent = Instance.new("RemoteEvent")
TeleportEvent.Name = "TeleportEvent"
TeleportEvent.Parent = ReplicatedStorage

local function teleportPlayer(player, placeId, teleportOptions)
	TeleportService:TeleportAsync(placeId, {player}, teleportOptions)