(I changed the min number of players to 2 as testing with 3)
but if I keep it at 4 players while testing it with 3 players it freezes for a few seconds and comes back with this;
I see what you were trying to achieve now, you wanted players to be distributed across three teams, two of which are solo teams (restricted to one player).
local players = game:GetService("Players")
local teams = game:GetService("Teams")
local team1 = teams.Team1 --Solo team.
local team2 = teams.Team2 --Solo team.
local team3 = teams.Team3 -- Default team.
local function startRound() --Example start round function.
for _, player in ipairs(players:GetPlayers()) do
player.Team = team3
end
local randomPlayer1 = team3:GetPlayers()[math.random(#team3:GetPlayers())]
randomPlayer1.Team = team1
local randomPlayer2 = team3:GetPlayers()[math.random(#team3:GetPlayers())]
randomPlayer2.Team = team2
end