Transparency of parts isn't changing as expected

Problem:
The transparency of the accessory isn’t changing even though I check if the accessory equals to the accessory type allowed.

Disclaimer:
The reason it isn’t working is because the loop will iterate through and compare each of the instances to each other at once, so even though the instance is equal to false at one point when comparing the two instances, it will equal to true the next which I don’t want.

All I’m basically asking is what is a better way to check the children inside a model and compare it to a table without the script giving different results.

Code Snippet


local Accessories = {
Accessory1 = "Hat",
Accessory2 = "Hair"
}

for _,Value in pairs(Accessories) do
	for _,Part in pairs(Substitute:GetChildren()) do
		if Part:IsA("Accessory") and Part.AccessoryType ~= Enum.AccessoryType[Value] then
			Part.Handle.Transparency = 1
		end
	end
end