Hello, devs. So I wanted to make a game that removes the players facial hair aka “Face” items. But the script isn’t working please help.
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
for _,V in pairs(Character:GetDescendants()) do
if (V.ClassName == 'Accessory') then
if V.AccessoryType == 'Face' then
V:Destroy()
end
end
end
end)
end)
local players = game:GetService("Players")
players.PlayerAdded:Connect(function(player)
player.CharacterAppearanceLoaded:Connect(function(character)
local humanoid = character:WaitForChild("Humanoid")
for _, accessory in ipairs(character:GetChildren()) do
if accessory:IsA("Accessory") then
if accessory.AccessoryType == Enum.AccessoryType.Face then
accessory:Destroy()
end
end
end
end)
end)
Use the “.CharacterAppearanceLoaded” event as has been suggested, it fires when the player’s character’s full appearance has loaded (based off their on-site avatar).