Link objects to closest polygon?

I'm sure this type of script exist just can't find for the life of me...