Check the PlayerAdded event, for every player add a number and when the number of players is what you need then go, or every second check the number of players in The server
The check with the for loop, the half of your server, when the players in the server reach what you need then do what you be, like:
Players.PlayerAdded do
if Players:GetPlayers() = Players.MaxPlayers / 2 then
—other code
Not sure if it’s gonna work I Made it on my phone so, it should check every time a player is added if the number of players is the max server size divided by 2, and then run the other code
I just worked it out myself, thank you to you guys who helped me though!
Here is my script for any who has the same problem:
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function()
local TotalPlayers = #Players:GetPlayers()
local HalfPlayers = TotalPlayers * 0.5
local RoundedPlayers = math.round(HalfPlayers) -- In case of Decimals, and Single Player
print(HalfPlayers.." Is Half of the Players")
print(RoundedPlayers.." Is Half of the Players, Rounded")
print(TotalPlayers.." Is all the Players: Before Repeat")
repeat
Players.PlayerAdded:Wait()
print("Waited For a Player")
until #Players:GetPlayers() == RoundedPlayers
print("Loaded Half the Server")
end)