How to make my crafting system more efficient

The problem is, this code will return an error if one of the items needed to craft is being held by the player (It would be in player.character, not player.backpack)