Hello, try this:
local players = game:GetService("Players")
local teams = game:GetService("Teams")
MapChosen = Maps[math.random(1, #Maps)]
MapChosen.Parent = workspace
for _, v in pairs(players:GetPlayers()) do
local HomeValue = teams.Home:GetPlayers()
local AwayValue = teams.Away:GetPlayers()
if #HomeValue > #AwayValue then
v.Team = teams.Away
elseif #AwayValue > #HomeValue then
v.Team = teams.Home
else
v.Team = math.random(1, 2) == 1 and teams.Away or teams.Home
end
end