Search code examples
luaroblox

How to find the gameID of a roblox place within a game?


I want to teleport a player from one place in my game, the lobby place, to another place in the game, but the TeleportService uses the GameId, and I cannot find the game ID. The Roblox Wiki says you can find it in the Game Explorer, but that has been deprecated. How can I find the GameID or is there an alternate way to teleport players.


Solution

  • The TeleportService:Teleport(placeId, player) function uses PlaceIds, not GameIds to teleport players. Once you publish your game, you can find the PlaceIds for it in a few places.

    In Lua :

    The DataModel.PlaceId property holds the current published place's Id, and you can access it from the global game object.

    local placeId = game.PlaceId
    

    In Roblox Studio :

    1. Open the place in Studio.
    2. From the View tab, open the Asset Manager.
    3. In the Asset Manager, double click on the Places. It should bring up a list of all of the Places for your game.
    4. Right click on one of the places
    5. Select Copy Id to Clipboard.
    6. Paste the Id where you need it.

    A picture of the Asset Manager widget in Roblox Studio. A place has been right clicked and a context menu has appeared. The option Copy ID to Clipboard is highlighted.


    On the Roblox website :

    1. From the Create page, go to My Creations.

    2. In the left hand tab menu, select Places. An image of the Creations dashboard on the roblox website. Under the Your Creations section, the Places tab is highlighted. A single game is visible.

    3. Find your place and click on it. It will take you to a page where you can click the Play button and hop into that place.

    4. Observe the URL for that page. It should be something like : https://www.roblox.com/games/<some_number>/<some_name>

    5. Copy the number out of the url. You now have the placeId.

    6. Paste the Id where you need it.

    An image of the web page that launches the roblox game. There is a red circle around the URL of the page to highlight the number inside it.