How to make ai pick up the closest gun

Set an insanely high starting distance as the “found” nearest gun’s distance - then For Each Loop through the guns in the scene to check each - in turn - to see if it is closer than the one saved as “nearest.”