'Reserve' a Server

That is not really what I mean

since disabling Script does not ‘Disable’ a Server / prevent Players from joining it.

I don’t understand what you mean by that, are you trying to prevent people from joining the same Reserved Server?

If you to prevent players from joining your game then just private the game altogether, unless you mean something else

i don’t think you get what he means, he means he wants a reserved server like a free VIP of sorts.

anyways apologies for the energy I gave off, I assume you want it reserved so if you go onto the reserve page like you showed, you get the code such as this.

(note this is on the page)

local TS = game:GetService("TeleportService")
local Players = game:GetService("Players")
local code = TS:ReserveServer(game.PlaceId) -- Returns a code
local players = Players:GetPlayers() -- Get a list of all players
TS:TeleportToPrivateServer(game.PlaceId,code,players) -- Actually teleport the players
-- You could add extra arguments to this function: spawnName, teleportData and customLoadingScreen

Yes I am. And I do not mean kicking them. For example there is 10 Reserved Servers. New Player joins. New Server should be created for him since there is no normal Servers left.

There’s a plugin for this, i forgot the name though but it’s really useful

@DigitalCopies @DumbHeadEdison

I am going to explain you my situation so it’s clear what I need.

I wanted to make a GUI for admins where they close game for updates. Admin GUI fires a cross - server message. The message gets read on all game servers. These game servers (if they are old version servers) reserve their server (since nobody can join and nobody gets teleported onto the server), teleport all players on the server to the menu and after 15 seconds (if the server is still running) it kicks the players who left.

I just want to know a code for ‘reserving’ such a server (something like turning a game server a VIP but not owned by anybody).

lemme get a video for this i heard of a “soft shutdown on youtube” please search for that.

I have already checked it out, that’s not what I like to use since my game would use a custom made system (I can check out soft shutdown’s code if it does have anything for reserving server rather than just teleporting players who join).

I am curious what this does (it probably reserves a custom game server and not current).

it makes it reserved just like a vip but it’s not.

Ohh, if you want to send global messages, try MessagingService | Roblox Creator Documentation.
Basically, all you need is MessagingService | Roblox Creator Documentation and MessagingService | Roblox Creator Documentation.

What you need to do is:
Once the GUI button is clicked, you will need to use PublishAsync.
Then, in a ServerScript or something you will need to use SubscribeAsync. The pages above will tell you about everything you need to know about the functions.

But it reserves not a current server and returns a code to it so you can teleport players there.

But the problem is that I need this server to reserve and make it not join - able anymore.

I am asking about reserving a server since I know everything except actually preventing TeleportService to make players join a reserved server.

You can run ReserveServer again to generate a new code so that other players won’t use the same Reserved Server Code and teleport to that same server.

What do you mean by this as I don’t really understand (since I think that ReserveServer reserves a random, not current, game server returning a code that allows people to join that random server using returned code - of course done by scripts)?

Well, here’s a code sample.

local TeleportService = game:GetService("TeleportService")
for i, player in pairs(game.Players:GetPlayers()) do
   local Code = TeleportService:ReserveServer(PlaceId)
   TeleportService:TeleportToPrivateServer(PlaceId, Code, {player})

This is a loop. Every time it loops through a player, it will generate a new code and Teleport the player to a Private Server (which isn’t owned by them) with that new code. Since every code is different, every player will be in their own server by themselves, UNLESS you use the SAME ReserveServer code to teleport other players to the same private server.

Oh yeah, forgot to mention: TeleportToPrivateServer creates a NEW server and teleports you, not teleporting you to an existing server. But, it won’t create a server if you use an existing/same code, instead it will just teleport you to that Private Server.

But I need to make THIS server private so the players don’t get teleported to it. It needs to be a function like: TeleportService:ReserveThisServer().
The key thing here is that I want THIS server to reserve.

So then from the “lobby” reserve a server and teleport yourself to it. And then nobody else can teleport to it.

Is this possible to reserve all active game (not lobby) servers? If yes then how?