So theres a part, and I want to find the closest part to it?
As you haven't even tried searching for relevant information, I will not give you a script, only a method. The best way to do this would be to probably scan through every part and find the .magnitude and record the part with the lowest magnitude and after it's iterated through all the parts you will be left with the closest part.