Now this error:
[20:12:48.842 - ServerScriptService.gameManager:17: bad argument #2 to ‘random’ (interval is empty)]
20:12:48.846 - Stack Begin
[20:12:48.847 - Script ‘ServerScriptService.gameManager’, Line 17]
20:12:48.848 - Stack End
Avoid polling if you can, when waiting for a minimum number of players you can just do the following:
local MIN_PLAYERS = 3
local Players = game:GetService("Players")
while #Players:GetPlayers() < MIN_PLAYERS do
Players.PlayerAdded:Wait()
end
Constantly looping with wait() is rarely the best solution.
What happens when you have only 3 players? If its 3 players on a team. do you only need one team? What if a player leaves midway through?
Also why are you using while wait() do? I get that you’re a beginner. But its still important to stick to a coding standard.
I recommend to take a step back and think about this system from an abstract point of view. See what functions you can use, the parameters those functions will need to achieve the same result without iteration, its totally possible. You can even hook up events to deal with situations where a player leave causing your game to be unbalanced.
Hey another issue, Know the right thing this time
On line 8 you got the players, all nice and everything until you realise it doesnt update
Add another line and with the new line at line 15, add this
Players = game.Players:GetPlayers()
This should hopefully work now
It works now. Thanks a lot!