Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 8 years ago
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

Log in to vote
0
Answered by 8 years ago

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

Ad

Answer this question