Noticed something.
Let’s say you start playing and you pick up the “can pickup” before the “log pickup”. All the following items you pick will be recognized as “can pickups”, even if you pick up the “log pickup”. And vice-versa, if you pick up first the “log”, the others will be recognized as “log pickups”.
About the local variable, i don’t know how to deal with it but using a regular variable.