Help with team sorting

I can not think of a way to get the two players in the game and sort them into either one of the two teams. How can I get the two players and parse them into the sortPlayers() function?

local Teams = game.Teams

-- Sort players
local function sortPlayers(playerOne, playerTwo)
	local intNumber = math.random(0, 2)
	if intNumber == 1 then
		playerOne.Team = Teams.Attacker
		playerTwo.Team = Teams.Defender
	else
		playerOne.Team = Teams.Defender
		playerTwo.Team = Teams.Attacker
	end
end

Is this a script or a local script?

A server side script in ServerScriptService.

I’ve found a solution to it which is a bit noob and buggy but meh.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.