Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I teleport to a friend's game?

I am trying to find the proper API to teleport to a friend's game.

If you join this game and hit Alt + M, it opens up a menu where you can join a friend's game. I would like to know how to replicate this.

The TeleportService doesn't seem to mention how to do this.

1 comment

1

game:GetService('TeleportService'):Teleport(PlaceId, game.Players.YourPlayerName)

1 answer

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

local function FollowPal(Player, Id)
	--- Teleports Player to another user's game
	-- @param Player the Player that will be teleported
	-- @param integer Id The userId of the Player they want to teleport to

    local Successful, Error, PlaceId, ServerId = TeleportService:GetPlayerPlaceInstanceAsync(Id)

    if Successful then
        TeleportService:TeleportToPlaceInstance(PlaceId, ServerId, Player)
    else
        print("Teleport error:", Error)
    end
end

FollowPal(Players.Narrev, 34011054)

This discussion is preserved as it was. New answers, comments, and votes are closed.