Is there any way to reserve a server from inside it?

So, basically, the reason I want to know how to do this, is because when a server reaches a certain amount of players, I want people to not be able to join in anymore. Is there any way to do this? If so, how?

From what it sounds like you want to do, all you need to do is go to Place settings and set the server limit to however many players you want.

If for some reason you want a server to not be completely full, then you could create a variable that tracks however many people are in the game. Run the PlayerAdded event so whenever a player joins the game, check if your variable is above a certain number. If not, let the player in and increase the variable number by 1.

If it does go above your limit, you can do player:Kick() and kick them out. Just make sure to also decrease 1 from the variable every time someone leaves using Player.Removing().

You could just set the server limit, if not then you could just do:

game.Players.PlayerAdded:Connect(function(plr)
	if #game.Players:GetPlayers() > 3 then --Replace 3 with whatever number you want it to be
		plr:Kick()
	end
end)

Yeah, but it’s kind of like a matchmaking system, a place inside of a place, I don’t want people joining a server and getting kicked out, it’s like Hypixel, if you’ve played that.

One problem, with setting the max players is that what if a player leaves, and another player joins mid-game?

I didn’t know you had a round-based game so the system I described above will probably be a bit more complicated. You could add a variable called “Playing” or something and set that to true anytime you are in mid-game, and if that’s the case you can kick the player or put them in a queue.

1 Like

Alvin Blox made a good tutorial on how to make a game and have matchmaking, but it may be different for you because you’re teleporting into different places.
(10) How To Make A Roblox Game - 2022 Beginner Tutorial! - YouTube - Link if you want it

I think I found a solution, already, I will just make it so that when they finish queueing it teleports them to another reserved server.

1 Like