A layered clothing remover button

I want to be able to have a game which allows layered clothing, but when you touch a button, your layered clothing gets removed (unless you reset or rejoin)

I havent really found a solution, except for disabling layered clothing entirely from my experience, but that’s not what i want.

The reason why i find this tricky is that layered clothing accessories on our characters are always renamed to the item’s name, just like other accessories.

Using a for loop, check if the accessories have one of the following:
image
(Only SurfaceAppearance or WrapLayer)

It doesn’t work for some reason, and doesn’t give an error. Heres my script incase theres something wrong: (yes there is the touched event stuff, theres alot of other stuff in the script since its an armor script)

for thenumber, accessoryinstance in pairs(char:GetChildren()) do
		if accessoryinstance:IsA("Accessory") then
			for theamount, childaccessory in pairs(accessoryinstance:GetChildren()) do
				if childaccessory:IsA("WrapLayer") then
					accessoryinstance:Destroy()
				end
			end
		end
	end
for i,v in pairs(char:GetDescendants()) do
	if v:IsA("WrapLayer") then
		v.Parent.Parent:Destroy() --v.Handle.Accessory
	end
end

Try this

for _, Child in ipairs(Character:GetChildren()) do
	if not (Child:IsA("Accessory")) then continue end
	local Handle = Child:FindFirstChild("Handle")
	if not Handle then continue end
	if Handle:FindFirstChildOfClass("WrapLayer") then Child:Destroy() end
end

I gave an example, OP could’ve used more security checks.