Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Removing the face and hat simultaneously doesn't work ... ?

local lplayer = game.Players.LocalPlayer
local Head = lplayer.Character.Head

for k,s in pairs(lplayer.Character:GetChildren())do
    if s:IsA("Hat") and Head.face.Texture ~= nil then
        s:Destroy()
    end
end

Why does this not work?

1 answer

✓ Accepted answer

So you told me that you wanted to remove the face along with hats. If this is true, your going about htis wrong

local lplayer = game.Players.LocalPlayer
local Head = lplayer.Character.Head

for k,s in pairs(lplayer.Character:GetChildren())do
    if s:IsA("Hat") then
        s:Destroy()
    end
end


This allows you to remove hats. To remove the face on roblox characters, you have to make another loop to make it work effectively

for i,v in pairs(lplayer.Character.Head:GetChildren()) do
	if v:IsA("Decal") then
          v:Destroy()
	end
end

This will loop through the player's head and delete anything that Is a decal

This discussion is preserved as it was. New answers, comments, and votes are closed.