There is an error in duckwit's code. BrickColor.new() requires a string, but math.random() returns a number. We must get a random object from a table with the form of table[int]. Putting a number in the brackets will give you the value from the table that corresponds with that number. Since math.random() returns a number, we're good to go.
player.TeamColor = BrickColor.new(teams[math.random(#teams)] )
I would like to point out, however, that this is unnecessary! Roblox provides an AutoAssignable property of Teams that will automatically assign and balance teams. Everyone player who joins will be assigned a team. This is also a better method, for it makes it impossible (except with an odd number) for teams to be unbalanced.