Character accessories wont remove?

Im trying to remove the players accessories but not ones such as face, neck, hair, and hat. But when i tried running it nothing happened, no errors.

My script:

wait(0.5)


wait(0.5)

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAppearanceLoaded:Connect(function(char)
		for i, v in pairs(char:GetDescendants()) do
			if v:IsA("Accessory") then
				if v.AccessoryType == Enum.AccessoryType.Hat or Enum.AccessoryType.Face or Enum.AccessoryType.Hair or Enum.AccessoryType.Neck then
					return
				else
					v:Destroy()
				end
			end
		end
	end)
end)

Ive also looked at other posts but literally nothing is working

2 Likes

Have you verified that you’re using the correct operator?

It looks like your current condition checks if the player’s accessory type matches any of the listed options, which should return the accessory if it does.

Additionally, note that using or in this manner won’t work correctly. You must specify the comparison for each condition. For example, this line:

if v.AccessoryType == Enum.AccessoryType.Hat or Enum.AccessoryType.Face or ...

is incorrect. Instead, it should be:

if v.AccessoryType == Enum.AccessoryType.Hat or v.AccessoryType == Enum.AccessoryType.Face or ...

This ensures that each condition is properly evaluated.

Solution:

Change the operators or switch return and v:Destroy()

1 Like