You would want to check on each point where the closest point is on each axis. Then if the connecter part hasn’t been created create a part that’s position is the middle of the two points and the length is the distance between the two points. It should be some very simple code to achieve what you want although more complex shapes will require much more complex code.