I only want to remove certain accessory types, such as hairs, and hats, leaving glasses, waist and shoulder accessories. What could I add to the script, so it will only target the type of accessory I want to remove?
function remove() local p = game.Players.LocalPlayer local c = p.Character wait(1) for i,v in pairs(c:GetChildren()) do if v:IsA("Accessory") then v:remove() end end end script.Parent.MouseButton1Down:connect(remove)
I assume I'd have to find the attachment part of the accessory, and target only that. But I'm not sure how I could seek out the attachments for each and every accessory part on ROBLOX.
The script is a local script inside of a ScreenGUI.
theres probably a much simpler way to do this but here we go.
To check the type of accessory, a way I found is to go under the accessory and in there is a handle and inside of that is an attachment. The name of the attachment is key to this. For example, a hair attachment would be called "HairAttachment"
function remove() local p = game.Players.LocalPlayer local c = p.Character wait(1) for i,v in pairs(c:GetChildren()) do if v:IsA("Accessory") then for e, r in pairs(v.Handle:GetChildren()) do --goes through all the items in the handle to find the attachment if r:IsA("Attachment") then --locates the attachment if r.Name == "HatAttachment" or r.Name == "HairAttachment" then --Here you would find the name of the attachment from the specific accessory type and add it to the list. I made it so it removes hats and hairs v:Destroy() end end end end end end script.Parent.MouseButton1Down:Connect(remove)