You can easily code that by making a durability variable and each time the person attacks while the item is equipped, you can increase the durability variable by 1. Let's say you want the item to have 10 durability, if the number is larger or equal to 10, remove the item and play a breaking sound.