Help with assigning colors

Hi,
I’m making an among us game in roblox and I am trying to make a script that gives you a random color that is different for each player however no matter what I do it will always put multiple players with the same color.
Here is my code:
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
if not player:FindFirstChild(“Color”) then
local colors = {
BrickColor.new(“Really red”),
BrickColor.new(“Really blue”),
BrickColor.new(“Camo”),
BrickColor.new(“Hot pink”),
BrickColor.new(“Bright orange”),
BrickColor.new(“New Yeller”),
BrickColor.new(“Really black”),
BrickColor.new(“Institutional white”),
BrickColor.new(“Royal purple”),
BrickColor.new(“Burnt Sienna”),
BrickColor.new(“Cyan”),
BrickColor.new(“Lime green”),
BrickColor.new(“Smoky grey”),
}

		local randomColor
		
		local lastColor1
		local lastColor2
		local lastColor3
		local lastColor4
		local lastColor5
		local lastColor6
		local lastColor7
		local lastColor8
		local lastColor9
		local lastColor10
		local lastColor11
		local lastColor12
		local lastColor13
		local lastColor14
		local lastColor15
		local lastColor16
		
		for i = 1,16 do
			if not randomColor or not randomColor == i then
				randomColor = colors[math.random(1,#colors)]
			end
		end
		
		for i,v in pairs(char:GetDescendants()) do
			if v:IsA("BasePart") or v:IsA("MeshPart") or v:IsA("UnionOperation") then
				if not v:FindFirstChild("NotColorable") then
					v.BrickColor = randomColor
					local color = Instance.new("BrickColorValue",player)
					color.Value = randomColor
					color.Name = "Color"
					local env = getfenv()
					for i = 1,16 do
						if i == nil then
							env["lastColor"..i] = randomColor
							break
						end
					end
				end
			end
		end		
	end
end)

end)

I think creating a script that checks if the color is already assigned to a player would solve that problem

game.ServerScriptService.ColorAssignScript

local Colors = {
	{nil, BrickColor.new("Burnt Sienna")}
	{nil, Color3.fromRGB(0, 0, 0)},
	{nil, Color3.fromRGB(255, 255, 255)}
}

game.Players.PlayerAdded:Connect(function(Player)
	local AvailableColors = {}
	for i, Color in pairs(Colors) do
		if Color[1] == nil then
			table.insert(AvailableColors, i)
		end
	end
	if #AvailableColors == 0 then Player:Kick("No colors available") end
	local ColorIndex = AvailableColors[math.random(1, #AvailableColors)]
	Colors[ColorIndex][1] = Player.UserId
end)

function GetPlayerColor(UserId)
	for i, Color in pairs(Colors) do
		if Color[1] == UserId then
			return {i, Color[2]}
		end
	end
end

game.Players.PlayerRemoving:Connect(function(Player)
	local ColorData = GetPlayerColor(Player.UserId)
	if ColorData ~= nil then
		Colors[ColorData[1]][1] = nil
	end
end)

local GetPlayerColorB = Instance.new("BindableFunction")
GetPlayerColorB.Name = "GetPlayerColor"
GetPlayerColorB.OnInvoke = function(UserId) return GetPlayerColor(UserId) end
GetPlayerColorB.Parent = script

A different server script

local GetColorFunction = game.ServerScriptService.ColorAssignScript:WaitForChild("GetPlayerColor")
print(GetColorFunction:Invoke(PlayerUserId))