IceOrb
|
  |
| Joined: 02 May 2010 |
| Total Posts: 1206 |
|
|
| 06 Jun 2013 09:43 AM |
Hey there, my team function balance is quite messed up in other words lol. I got advised to use math.random so that it doesn't keep sorting players into the exact same blue team and red team. WIth a few tips from what he said, I attempted it myself but I think I've done quite a majority of it wrong.
Here is the code:
function randomiseteam() thePlayers = game.Players:GetPlayers(math.random) for i, v in pairs(1, #thePlayers) do if v.TeamColor ~= BrickColor.new("Lavender") then if i % 2 == 0 then v.TeamColor = BrickColor.new("Bright red") else v.TeamColor = BrickColor.new("Bright blue") end v:LoadCharacter() end end end
Any help would be very much appreciated, still learning myself! |
|
|
| Report Abuse |
|
IceOrb
|
  |
| Joined: 02 May 2010 |
| Total Posts: 1206 |
|
|
| 06 Jun 2013 09:58 AM |
Here is the original script:
function randomiseteam() for i, v in pairs( Game.Players:GetPlayers( ) ) do if v.TeamColor ~= BrickColor.new("Lavender") then if i % 2 == 0 then v.TeamColor = BrickColor.new( "Bright red" ) else v.TeamColor = BrickColor.new( "Bright blue" ) end v:LoadCharacter() end end end
Any help? |
|
|
| Report Abuse |
|