Face will not get destroyed no matter what I do

I am using ChildAdded, and iterating through the descendants of the character to find every base part and decal, and make them transparent. The code below works for EVERYTHING, but the face decal on the head.

Literally no matter what I do, the face does not get deleted. I have absolutely no idea what the hell is going on. PLEASE HELP!

ChildAddedConnection = Character.ChildAdded:Connect(function(Object)
                if Object:IsA("BasePart") then
                    Object.Transparency = 1
                    if Object.Name == "Head" then
                        local Connection
                        Connection = Object.ChildAdded:Connect(function(HeadChild)
                            if HeadChild:IsA("Decal") then
                                print(HeadChild)
                                HeadChild:Destroy()
                                Connection:Disconnect()
                                Connection = nil
                            end
                        end)
                    end

                elseif Object:IsA("Accessory") then
                    Object:WaitForChild("Handle"):Destroy()
                end
            end)

            --// Backup function to catch descendants that were not set to be invisible.
            local Descendants = Character:GetDescendants()
            for _, Object in pairs (Descendants) do
                if Object:IsA("BasePart") then
                    Object.Transparency = 1
                elseif Object:IsA("Decal") then
                    print(Object)
                    Object.Parent = nil
                    print(Object.Parent)
                elseif Object:IsA("Accessory") then
                    Object:WaitForChild("Handle"):Destroy()
                end
            end

Try setting Object.Transparency = 1, instead of Object.Parent = nil.

I have. I have tried setting parent to nil, destroying, setting transparency, setting texture to an empty string. Absolutely nothing works and its driving me mad.

wait
you do know decals have a transparency property right
no need to make a code this large just to make all the parts transparent

also use DescendantAdded because parts are inside of accessories

1 Like
-- example
local part = workspace.Part -- insert path to part here

part.Decal:Destroy()

After seeing this I decided to go into studio and give it a shot. I used this code in StarterCharacterScripts as a server script:

local Character = script.Parent

local function makeObjectTransparent(part)
	if part:IsA("BasePart") or part:IsA("Decal") then
		part.Transparency = 1
	end
end

for _, part in ipairs(Character:GetDescendants()) do
	makeObjectTransparent(part)
end

Character.DescendantAdded:Connect(makeObjectTransparent)
1 Like