What I mean is: The game waits until 4 players are in the server, then continues on. I tried to find a command for this, but it came up with nothing of the sort. Instead I got things like to check how many players are playing the game in total. I've seen games where if there isn't enough players it says, "Waiting for players..." I want to do this as well, but I cannot find a command for it. Maybe there is an alternative, such as checking how many players are in an area, such as a lobby.
This is done by evaluating the length of an array containing all current Player Objects.
You can achieve that with the GetPlayers method, paired with the length operator:
local Players = game:GetService("Players") print("Number of Player(s) in-game: "..#Players:GetPlayers())
You can integrate this code snippet into a repeat wait()
clause to yield the progression of your main program until the requirement is met:
local Players = game:GetService("Players") local PlayerCountRequirement = 4 repeat wait() until #Players:GetPlayers() >= PlayerCountRequirement