Answered by
8 years ago Edited 8 years ago
This is just an idea on how you could do it. You need to be able to use a for loop to go through the players and assign teams and such. You can add a way to respawn after the if statement if you would like.
01 | repeat wait() until game.Players.NumPlayers > = 2 |
02 | print ( "Players are in the game" ) |
05 | local BlueTeam = math.random( 1 ,game.Players.NumPlayers) |
10 | for i,v in pairs (game.Players:GetPlayers()) do |
14 | print ( "Red team: " ..v.Name) |
The math.random command is basically a way to get a "random" number between the first and second parameter. In other words, if I did math.random(1,100), I would get a random number between 1 and 100. If you make it without anything inside of the parenthesis, it will choose a random number between 0 and 1.
If I have helped answer your question, then please remember to accept my answer. Otherwise, please comment on what I could have done to better help you understand.