How can i make this?

Hey i came on here today because im having issues with my system. it basically chooses a random color to make each player but if the color is taken from another player in the game then it will chose another random color and it will keep going for each player (hopefully this makes sense)

heres my code.

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local CharactersFolder = ReplicatedStorage.Assets.Characters:GetChildren()

game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		repeat task.wait() until Player.Character

		for i, v in pairs(Character:GetChildren()) do
			if v:IsA("Accessory") or v:IsA("Shirt") or v:IsA("Pants") then
				v:Destroy()
			end
		end

		for i = 1, #CharactersFolder do
			if CharactersFolder[i]:IsA("Color3Value") and CharactersFolder[i]:GetAttribute("Taken") == false then
				local randomColor = CharactersFolder[math.random(1, i)]
				print(randomColor.Name)

				if randomColor:GetAttribute("Taken") ~= false then continue end
				randomColor:SetAttribute("Taken", true)

				Player:SetAttribute("CharColor", randomColor.Name)

				Character:WaitForChild("Body Colors").HeadColor3 = randomColor.Value
				Character:WaitForChild("Body Colors").LeftArmColor3 = randomColor.Value
				Character:WaitForChild("Body Colors").LeftLegColor3 = randomColor.Value
				Character:WaitForChild("Body Colors").RightArmColor3 = randomColor.Value
				Character:WaitForChild("Body Colors").RightLegColor3 = randomColor.Value
				Character:WaitForChild("Body Colors").TorsoColor3 = randomColor.Value
			end
		end
	end)
end)

game.Players.PlayerRemoving:Connect(function(Player)
	local findColor = ReplicatedStorage.Assets.Characters[tostring(Player:GetAttribute("CharColor"))]

	if findColor then
		findColor:SetAttribute("Taken", false)
	end
end)

here is the characters folder (they are each color 3 values that have their own colors)

image

PLEASE give me tips on how i can improve and fix this