Send a player to a server and then make them go back

Hey! Sorry if the title is not explaining enough. I have a system where the player teleports to another place, how do I make them go back to the same server?

Like a player is in a server with their friends, they get teleported to a different place and their friends stay. Im trying to make it so the player goes into the same server that they were in before. (not talking about the same game, but same server)

The only solution i can think of is getting a sort of server id, but I have no idea how to do that : /
Is this even possible? All help is appreciated!

3 Likes

Assuming you’re using TeleportService | Roblox Creator Documentation, you can use TeleportOptions to change this. You could probably just send along the PlaceId and the JobId with TeleportOptions | Roblox Creator Documentation, retrieve that with TeleportOptions | Roblox Creator Documentation in the other server, then use that data to create a new TeleportOptions instance again to teleport them back by setting the ServerInstanceId to the JobId.

By the way, you can get the JobId by doing

game.JobId
3 Likes

Thank you! : D
Ill test this out later today or tomorrow!

1 Like

Yeah, teleporting the player with teleport data is what you need, that way you can instruct the receiving server to send the player back if necessary.

1 Like

So I’m assuming you want the player to be put in their friend’s server. If so, use TeleportAsync. It will allow the player to follow their friend in a game! In other words, it will automatically put the player in their friend’s server. (It will randomize what friend if there’s multiple in one experience though.)

1 Like

I would like it to work regardless of if you are friends or not, but thanks for the help!

So you’d need a third party to track server ID’s and all that.

1 Like