Locking servers

This is my first post on the Developer Forum, so let’s just start!

Hey Developers,
I am trying to create a matchmaking system, where players will start in a lobby and then get sent to another place. Once they got teleported to the game place I want that server to be locked and avoid new players to join it.

I know I could just kick joining players using a script but it’s probably going to be pretty annoying constantly getting kicked out before finding a server that isn’t locked.

Therefore I would need something like a signal sent to Roblox so new players just don’t get teleported to a locked server anymore and instead a new one is being created.

I hope you got what I’m trying to do. If not, in addition to development support I’m also happy about tips to improve my posts in the future.
Thanks in advance!

2 Likes

Have you tried to search for the same problem?

Do either of these help? If not, tell us why.

1 Like

What you’re looking for are Reserved Servers :happy1:

6 Likes

A way to maybe do this (i dont know if this is the best way) is to have a data store labeling each server in a way and once its labeled as full or something then the script wont send people to it. So maybe give a server a number in order from 0 and then set it to false once you are done accepting people into it. Anyways I dont know if this is the best way.

1 Like

You might want to use TeleportService:ReserveServer like that:

local TeleportService = game:GetService("TeleportService")

local PlaceID = YOUR_PLACE_ID

local teleportCode = TeleportService:ReserveServer(PlaceID)
local players = game.Players:GetPlayers() -- You don't need to teleport all players
TeleportService:TeleportToPrivateServer(PlaceID, teleportCode, players)

For further information, look at Roblox Api Reference

It’s been mentioned two times by now but let me expand: there is no way to lock servers. What you want is to create a reserved server, which is only joinable through use of TeleportToPrivateServer and the access code to the server.

Reserved servers void Roblox’s automatic matchmaking (the process that creates and places users in servers) and instead give you control over who enters the server. Therefore, accomplishing what you need instead of trying to investigate into a way to lock servers.


@TheDapGames

Don’t do this. This is a waste of DataStore requests and you have no control over Roblox matchmaking. You can’t just disallow joining of servers on the fly.

2 Likes