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 queue to a reserved server?

I have a game and a queue script. I want the script to teleport players into one of the games that is part of the start place, but I want everyone who's in the same queue to go to the same server. I have the basic teleport code but I'm not sure how to reserve a server for a separate game. I have seen it in games like "Camping" and, "House Party" so I know that it's possible.

Here is the code

    if player_count == 4 then 
	print('teleporting')
	local queue1 = game.ReplicatedStorage.queue1:GetChildren()
local TS = game:GetService("TeleportService")
	for i,v in pairs(queue1) do
			local plr = game.Players:WaitForChild(v.Name)

TS:Teleport(3350448651,plr)

1 answer

Assuming you create a table with the players you want to teleport you can use ReservedServers to create a personal server for just this group of players.

local TS = game:GetService("TeleportService")

local players= {}

--add players to Players using table.insert()
 
local code = TS:ReserveServer(game.PlaceId) -- Returns a code
 
TS:TeleportToPrivateServer(game.PlaceId,code,players) -- Actually teleport the players
-- You could add extra arguments to this function: spawnName, teleportData and customLoadingScreen

6 comments

0

Hi, I have seen this code before but I don't know how to reserve a server that isn't the same as the start place. I dont want a private server in the same game, I want one in one of my other places.

0

@mrorangethegamer you can only use reserve servers using places under the same game

0

@DanzLua My place is under the same game

0

@DanzLua but I dont know how to reserve a server in the other place.

0

@mrorangethegamer Instead giving ReserveServer() game.PlaceId give it the id of that place

0

Also dont forget to change game.PlaceId in TeleportToPrivateServer() to that place too

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