When trying to identify the team color is the same as another team, it identifies as false with a team with the same team color

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve?
    I’m trying to make a GUI which will create teams and check if a new team was created to add a button to do stuff with.

  2. What is the issue?
    The team color is identifying as false when there is another team with the same team color and will continue making teams which I do not want. The code:

		local ExistingTeam
		for _,Team in pairs(game.Teams:GetTeams()) do
			print(BrickColor.new(coloursInput))
			print(Team.TeamColor == BrickColor.new(coloursInput))

			if Team.TeamColor == BrickColor.new(coloursInput) then
				ExistingTeam = Team
			end
			if ExistingTeam then
				return
			end
			local NewTeam = Instance.new("Team")
			NewTeam.TeamColor = BrickColor.new(coloursInput)
			NewTeam.AutoAssignable = false
			NewTeam.Name = teamInput
			NewTeam.Parent = game.Teams
			break
		end
  1. What solutions have you tried so far?
    I have looked at countless devforum threads; however I can’t find one related to the issue I have at all(I’m hoping its not me being stupid)
local teams = game:GetService("Teams")

local function createNewTeam(newTeamColor)
	for _, team in ipairs(teams:GetTeams()) do
		if team.TeamColor == newTeamColor then
			return
		end
	end
	
	local newTeam = Instance.new("Team")
	newTeam.Name = newTeamColor.Name.." Team"
	newTeam.TeamColor = newTeamColor
	newTeam.AutoAssignable = false
	newTeam.Parent = teams
end

while task.wait() do
	createNewTeam(BrickColor.new("White"))
end

I wrote a script similar to this and it works fine for me. Only a single “White” team is made.

I’m going to assume coloursInput isn’t a valid argument for the BrickColor class constructor function.

No, Its a input from a textbox.

Right, so it’s not a valid argument for the BrickColor class constructor function then.

Thanks, I was not thinking correctly at the time.