Use common debugging.
Print the total ammount of items every time you pick one. Is it actually doing something and recognizing one of the items has been picked up, or does it never work?
Does it work but the “total” is off by one or something else?
Try using prints for every action that should be happening and for all the information that you can compare, like the total number of items on the scene when it starts. Then you may spot where the issue or issues are and fix them one by one.