Have you checked it items was an array or a single variable?
items.pos.x and items.pos.y
You’re making your charter to multiple places so it gets confused.
use robanybody’s idea or you can make a new variable “item”
item = hero.findNearest(items)
and use that to replace “items” in that line of code.