I need help with TeleportService to teleport to an Unjoinable, Private game, as part of a story!

I want to teleport a group of people to my 2nd game from my main game, in a fresh server in the 2nd game, with it not overlapping servers with people from another server of the 1st game that is also trying to get to the 2nd game.

The problem is I don’t know how to make it so when I teleport them it’s going to for sure be a server that both A. Nobody is in and B. Nobody can join except the first to teleport there.

I tried using TeleportOptions but it didn’t do anything but say Bad Request, and I’m thinking it will only reserve a server like that for the game ur already in, and not one you’re trying to send people to.

I want this to be a game that has a story line like 1 Main game, and then part 2 new game, part 3 new game. So when im teleporting for the group of players to go to the next story, I don’t want people to already be in the game, which would make the story not function correctly. And I also don’t want anybody to be able to join the story who tries to join. How is this achievable? I am at a loss of what code to use to achieve this with teleportservice.

3 Likes

You might want to look into this. This is the code sample they give:

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

local placeid = -- your destination placeid

local code = TeleportService:ReserveServer(placeid)

local players = Players:GetPlayers() -- change this to any player you wanna send

TeleportService:TeleportToPrivateServer(placeid, code, players)
-- You could add extra arguments to this function: spawnName, teleportData and customLoadingScreen

Please let me know if this solved your problem!

PS: you could keep the code saved somewhere which would make it possible for you to allow other players to join the same server thanks to it.

2 Likes