# Place & Teleport

## Overview

A Place is a unit used to compose a **single World into multiple spaces.**

A World consists of a **Start Place** and **multiple Sub Places**, and players can freely move between Places through TeleportService.

This structure allows you to **seamlessly connect various experiences within a single World**, such as lobbies, game stages, shops, and personal spaces.

## Place Structure Examples

Using Places, you can build structures such as:

* Separating lobby and gameplay spaces
* Creating independent spaces for different game modes
* Distributing server load by server instance
* Building long-session gameplay content
* Implementing match-based game structures

## World and Place Structure

A World represents a single game experience, while a Place is an individual space contained within that World.

```
[World A]
 ├─ Place : Lobby
 ├─ Place : Battle (A Mode)
 ├─ Place : Battle (B Mode)
 └─ Place : MyHome
```

* A single World can contain multiple Places.
* A single Place can belong to only one World.
* The Start Place is the default Place players enter first when joining a World.
* Sub Places can be organized into functional spaces such as lobbies, battle areas, and result screens.

## Managing Places

### Registering and Connecting Places

When publishing a project for the first time in OVERDARE Studio, you can connect it as a Sub Place of an existing World.

To register the project as a Place connected to an existing World, enable **Add to Existing World** on the World information page.\
(You must set the **Owner** before this option becomes available.)

<figure><img src="/files/8ydtDGvZePHKkT6Wm2rv" alt=""><figcaption></figcaption></figure>

Click the **Connect button** for the World you want to connect to.

<figure><img src="/files/5vZ2KUjQFCVFae12Ucc3" alt=""><figcaption></figcaption></figure>

After entering the required details, select the **Next button**.

<figure><img src="/files/yAehBAmZT2GpwXd5qRCs" alt=""><figcaption></figcaption></figure>

### Viewing Connected Places

You can view the list of Places connected to the current World in Studio or Creator Hub.

In Studio Home, open the **My Worlds tab** to view the Places connected to each World.

<figure><img src="/files/jwgf92t3ngydXjqUQVHT" alt=""><figcaption></figcaption></figure>

In Studio, open the project and select **Places** in the **Asset Manager** panel to view the connected Places in the current World and identify the Place currently being edited.\
(You can right-click a Place to copy its PlaceId from the context menu.)

<figure><img src="/files/m4lAOSOgQ6Hruq8nhAwt" alt=""><figcaption></figcaption></figure>

In Creator Hub, click a World in the Dashboard, then open the **Place tab** to view the connected Places.

<figure><img src="/files/Wfa9idSVzBfImvmNMlvA" alt=""><figcaption></figcaption></figure>

### Disconnecting Places

In Studio Home, open the options menu for a Place connected to a World, then select **Remove from World** to disconnect the Place from the World.

<figure><img src="/files/eljMlhBouuzsgLsVW025" alt=""><figcaption></figcaption></figure>

In Creator Hub, open the **Place tab** for a World in the Dashboard, then select **Remove from World** from the Place options menu to disconnect the Place from the World.

<figure><img src="/files/ztve3MAN49CBQQKCO0qa" alt=""><figcaption></figcaption></figure>

### Viewing and Reconnecting Detached Places

In Studio Home, you can view Places that are not connected to any World in the **Detached Places** **section**.

<figure><img src="/files/XXXA2ANQB3udLD319MKg" alt=""><figcaption></figcaption></figure>

In Creator Hub, open the **Place tab** for a World in the Dashboard, then click the **Add Place button** to view Places that are not connected to a World.

Select the **Add button** for the Place you want to connect to add it to the current World.

<figure><img src="/files/EEXzV22QvttYVucUMtrs" alt=""><figcaption></figcaption></figure>

### Updating Sub Place Information

Unlike Creator Hub, **Place connection information displayed in Studio is refreshed every minute.**

To immediately reflect the latest state, sign in again or reopen Studio Home or the project.

## Scripting Features

### Notes

* Teleport features can only be used from **server-side scripts**.
* Place teleportation through TeleportService is **only supported between Places connected to the same World**.
* It is recommended to handle teleport failure cases with proper exception handling logic.

### Teleporting to a Public Session Place (TeleportAsync)

Use this to move players to another Place through a public server session.

```lua
local TeleportService = game:GetService("TeleportService")

-- Execute teleport
local success, errorOrResult = pcall(function()
    local targetPlaceId = 1234 -- PlaceId of a Place connected to the current World
    local players = { player } -- Players to teleport
		
    local teleportResult = TeleportService:TeleportAsync(targetPlaceId, players)     
    return teleportResult
end)
```

* When teleporting to the currently joined PlaceId, players may enter a different server session.
  * In other words, teleporting again to the current PlaceId does not guarantee rejoining the same server session.

### Teleporting to a Private Session Place (TeleportAsync)

#### Creating a Private Session (ShouldReserveServer Option)

Use this to create a new private server session when teleporting players.

```lua
local TeleportService = game:GetService("TeleportService")

-- Configure TeleportOptions
local options = Instance.new("TeleportOptions")	
options.ShouldReserveServer = true -- Whether to create a new reserved server session

-- Execute teleport
local success, errorOrResult = pcall(function()
    local targetPlaceId = 1234 -- PlaceId of a Place connected to the current World
    local players = { player } -- Players to teleport
		
    local teleportResult = TeleportService:TeleportAsync(targetPlaceId, players, options)     
    return teleportResult
end)
```

#### Teleporting to a Specific Server Instance (ServerInstanceId Option)

Use this to move players to a specific running server instance.

```lua
local TeleportService = game:GetService("TeleportService")
local DataStoreService = game:GetService("DataStoreService") 
local SessionStore = DataStoreService:GetDataStore("PlayerPrevSessionId")

-- Load the previously saved session Id
local jobId = nil
local success, errorOrLoadValue = pcall(function()
    return SessionStore:GetAsync(player.UserId)
end) 

if not success or errorOrLoadValue == nil then
    return
end
jobId = errorOrLoadValue 

-- Configure TeleportOptions
local options = Instance.new("TeleportOptions")	
options.ServerInstanceId = jobId    -- Join a specific public server (pass a game.JobId value)
options.ShouldReserveServer = false -- Whether to create a new reserved server session (must be false when using ServerInstanceId)

-- Execute teleport
local success, errorOrResult = pcall(function()
    local targetPlaceId = 1234 -- PlaceId of a Place connected to the current World
    local players = { player } -- Players to teleport
		
    local teleportResult = TeleportService:TeleportAsync(targetPlaceId, players, options)     
    return teleportResult
end)
```

* ServerInstanceId can only be used with public server sessions, and players cannot join sessions that have already ended.

### Creating and Teleporting to a Reserved Server (ReserveServerAsync)

Use this to create an isolated server session and move players to that server.

```lua
local TeleportService = game:GetService("TeleportService")

local targetPlaceId = 1234 -- PlaceId of a Place connected to the current World

-- Create a reserved server
local success, errorOrAccessCode = pcall(function()
    return TeleportService:ReserveServerAsync(targetPlaceId)
end)

if not success or errorOrAccessCode == nil or errorOrAccessCode == "" then
    return
end

-- Configure TeleportOptions
local options = Instance.new("TeleportOptions")	
options.ReservedServerAccessCode = errorOrAccessCode -- Reserved server access code
options.ShouldReserveServer = false                  -- Whether to create a new reserved server session (must be false when using ReservedServerAccessCode)

-- Execute teleport
local success, errorOrResult = pcall(function()
    local players = { player } -- Players to teleport
		
    local teleportResult = TeleportService:TeleportAsync(targetPlaceId, players, options)     
    return teleportResult
end)

print("TeleportAsyncResult.ReservedServerAccessCode : ", errorOrResult.ReservedServerAccessCode)
```

* The same PlaceId must be used when creating and joining a reserved server session.
* Once a reserved server session ends, the associated access code can no longer be used.

### Teleport Initialization Failure Event (TeleportInitFailed)

Use this to implement exception handling and retry logic when teleporting fails.

You can reuse the same teleportOptions to retry the teleport with the same configuration.

```lua
local TeleportService = game:GetService("TeleportService")

local function OnTeleportInitFailed(player, teleportResult, errorMessage, placeId, teleportOptions)
    print("[TeleportInitFailed] playerName : ", player.Name)		  
    print("[TeleportInitFailed] Result : ", teleportResult)
    print("[TeleportInitFailed] Error : ", errorMessage)
    print("[TeleportInitFailed] Target Place : ", placeId)       
end
TeleportService.TeleportInitFailed:Connect(OnTeleportInitFailed)	
```

### Getting the Server Session ID (game.JobId)

game.JobId is a unique ID that identifies the currently running server session.

Use this to identify the current server session or to move players to a specific session through ServerInstanceId.

```lua
local DataStoreService = game:GetService("DataStoreService") 
local SessionStore = DataStoreService:GetDataStore("PlayerPrevSessionId")

local success, errorOrLoadValue = pcall(function()
    local saveValue = game.JobId    		
    SessionStore:SetAsync(player.UserId, saveValue) 
        
     print("Save Prev Session Id : ", saveValue)
end)
```

### Getting the Place ID (game.PlaceId)

Use this to identify the current Place or implement Place-based logic.

```lua
local placeId = game.PlaceId

local PLACE_DATA =
{
	["Lobby"] = 1234,
	["Stage1"] = 1235,	
	["Stage2"] = 1236,	
	-- ...
}

if placeId == PLACE_DATA.Lobby then
    print("Lobby")
end
```

### Unsupported Features

* TeleportOptions:SetTeleportData and GetTeleportData
* PrivateId and PrivateServerId properties

## Use Cases

* Separate lobby and gameplay spaces, then move matched players to a battle Place.
* Move party members to a reserved server to create a private session.
* Split Places by game mode to independently operate PvP, PvE, tutorial, and event spaces.
* Configure separate Places for different difficulty levels such as Easy, Normal, and Hard.
* Store JobId values to support session rejoin or return-to-session systems.
* Divide content into multiple Places so each server runs only the required space and logic, reducing server load.
* Separate large-scale Worlds into functional Places to reduce loading overhead and simplify management.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.overdare.com/manual/studio-manual/game-development/place-and-teleport.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
