Equally sharing out players on 4 teams

Hey there!!

I recently made a post about sharing players out on 2 teams, but now i wanted to try sharing them out on 4.

here is my 2 teams script:

local Teams = game:GetService("Teams")
local Players = game:GetService("Players")
function module:setTeams()
	local team1 = Teams.Blue
	local team2 = Teams.Red
	for _,v in pairs(Players:GetPlayers()) do
		if #team1:GetPlayers() >= #team2:GetPlayers() then
			v.Team = team2
		else
			v.Team = team1
		end
	end
end

here is what i have done so far:
I haven’t done anything except from the variables since i have absolutely no clue!

function module.sortTeams()
	local Teams = game:GetService("Teams")
	local Players = game:GetService("Players")

	local team1 = Teams.Strawberry
	local team2 = Teams.Apple
	local team3 = Teams.Orange
	local team4 = Teams.Tomato
	for _,v in pairs(Players:GetPlayers()) do
		if #team1:GetPlayers() >= #team2:GetPlayers() then
			v.Team = team2
		else
			v.Team = team1
		end

	end
end

All replies are greatly appreciated!

Found a cool function that does it already for n (any) amount of teams, it’s real detailed and should work.