Unable to "filter" part names, all parts being opaque

Hi!

Either my rust with Lua grows more as I “procrastinate” with my work, or I’m just plain stupid, but I am having a hard time using a ‘blacklist’ of sorts to keep certain parts transparent and other parts opaque.

Currently, I have it set up to run a for i = 1 in each “group” of limbs (this is how our morphs are constructed), and within that is another for loop, which uses GetChildren() to grab the parts. What I am simply trying to do is compare the part names to the blacklist, and if the names aren’t equivalent then make them opaque, otherwise just leave them transparent. Unfortunately, I’m at a loss for words as no matter how I fiddle with it, it is making every part opaque (which leaves an undesirable effect)

This code is currently rough and isn’t how I would normally write or structure it, but this is more like grey boxing, and yet I’m still unable to get it to work. Any suggestions or help would be appreciated!

local obj = script.Parent
pGemLoc = game.ServerStorage.PoofGems

debounce = false

local morphObjs = { 
	["Chest1"] = "UpperTorso",
	["Chest2"] = "LowerTorso",
	["Hair"] = "Head",
	["LeftArm1"] = "LeftUpperArm",
	["LeftArm2"] = "LeftLowerArm",
	["LeftArm3"] = "LeftHand",
	["LeftLeg1"] = "LeftUpperLeg",
	["LeftLeg2"] = "LeftLowerLeg",
	["LeftLeg3"] = "LeftFoot",
	["RightArm1"] = "RightUpperArm",
	["RightArm2"] = "RightLowerArm",
	["RightArm3"] = "RightHand",
	["RightLeg1"] = "RightUpperLeg",
	["RightLeg2"] = "RightLowerLeg",
	["RightLeg3"] = "RightFoot"
}

local partBlacklist = {
	"Middle",
	"W1",
	"W2",
	"W3",
	"W4",
	"W5",
	"W6",
	"W7",
	"W8",
	"W9",
	"W10",
	"W11"
}

obj.OnServerEvent:Connect(function(player)
	if debounce == false then
		debounce = true
		local char = player.Character
		local hrp = char.HumanoidRootPart.Position
		for l,v in pairs(morphObjs) do
			local charPart = char:WaitForChild(l)
			print(charPart)
			local parts = charPart:GetChildren()
			for i = 1, #parts do
				print(parts[i])
				if parts[i].className == "Part" or parts[i].className == "UnionOperation" or parts[i].className == "WedgePart" or parts[i].className == "MeshPart" then
					print(parts[i])
					for e = 1, #partBlacklist do
						if parts[i].Name == partBlacklist[e] then
							parts[i].Transparency = 1
						else
							parts[i].Transparency = 0
						end
					end
				end
			end
		end
		wait(0.1)		
	end
	debounce = false
end)

The code is a little hard to read and I’m not sure if this is a visual thing for me or not, but your char variable looks as though its a function.

From your list, it looks like you’re trying to find "Chest1" inside your character. Which unless you have a custom character, Chest1 will not be a valid child.
There may be other parts that I havent pointed out but I’m still trying to read it all.

Update! After sleeping on it, my brain completely forgot about table.find, and that has seemed to fix my issue.