I want 1 person to go to the "Deep blue" team while everyone else goes to the "Bright red" team, and then I want them all to respawn simultaneously.
I don't know how to do this.
Could someone point me in the right direction?
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.
repeat wait() until game.Players.NumPlayers >= 2 -- wait until a random number can be made, you could change this if you like to a certain number or a different way to wait print("Players are in the game") -- I like to have prints to know where the script errors local BlueTeam = math.random(1,game.Players.NumPlayers) -- chooses which player will be on the blue team print(BlueTeam) -- print the number generated wait(1) for i,v in pairs(game.Players:GetPlayers()) do -- going through all of the players if i == BlueTeam then -- if the index of the player matches the number chosen for blue team print(v.Name) -- you can change this to changing their team else print("Red team: "..v.Name) -- you can change this to changing their team end end
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.