I want to hide the LocalPlayer’s humanoid’s face accessories, but only on the client.
It doesnt work with LoadHumanoidDescription as that is only for the server and I dont know how to tell apart a face accessory from any other accessory so it only hides the face accessory. I’ve read that LoadHumanopidDescription has no client-side work arounds, so how can I tell apart a face accessory from any other?
All face accessories have an attachment named “FaceFrontAttachment” parented to the handle part of the accessory.
Here is a script:
function isFaceAccessory(accessory)
local handle = accessory:FindFirstChild("Handle")
if accessory:IsA("Accessory") and handle:FindFirstChild("FaceFrontAttachment") ~= nil then
return true
else
return false
end
end
The if statement wouldn’t be necessary. You can return the evaluation of a statement. You can return the result of a FaceFrontAttachment search in the accessory and if there is one, it’ll return true, otherwise false. The accessory check should be handled outside of this function as well.
If you want to get really specific and avoid class-checking, the Humanoid has a great method called GetAccessories which, as you can probably tell from the title, allows you to fetch all the hats a user is wearing. This will return any hats either on the accessory or legacy hat system.
for _, accessory in ipairs(humanoid:GetAccessories()) do
if accessory:FindFirstChild("Handle") and accessory.Handle:FindFirstChild("FaceFrontAttachment") then
accessory.Handle.LocalTransparencyModifier = 1
end
end