Hello! I want to make another “place” in my experience, in other words a sub-game inside my experience. I know I can use teleport service to teleport players to that place using “place id”, but I also want to make it so players can teleport to the same server as their friends. For example, I am in the “starter place” of the experience, and my friend is in another “place”. I want to be able to teleport to that “another place” in the same server as my friend. How do I do that? (By the way I know how to get friends) Thanks!
Edit: I just realized that teleport service also includes something called “Teleport Data”. I don’t know how it works, but if it’s possible to use it to teleport players to their friend’s server, how would I go about doing that?
You can detect the person the player tried to join when they entered the experience, using Player.FollowUserId. Then you can teleport the player to their friend using this:
local ts = game:GetService("TeleportService")
-- later:
local this, _, placeid, jobid = ts:GetPlayerPlaceInstanceAsync(player.FollowUserId)
if this then return end -- User in this server?
ts:TeleportToPlaceInstance(placeid, jobid, player)
If this works, you should wrap it in a pcall or task.spawn.
I tested it but how do I join a server in that place if my friend isn’t there? aka none of my friends are in that “place” how do I join it with teleport service?