Ethan
the problem is that the System > Create Object takes some time to actually create the object (or at least add the new instance to the list for that object - that seems to happen on the next tick).
So, when the function is trying to Pick the Sprite2 nearest to Sprite, it doesn't know the one you just created exists yet. Therefore, it doesn't pick it, and then the Sprite.isChanged variable is not getting set to true, so the next time through the Repeat loop that Sprite is still available to have a Sprite2 created on it.
Having a function re-loop through every Sprite while in a Repeat loop isn't an ideal way to do things. It would be better to pass the Sprite.UID into the function as a parameter, then in the fuction Pick Sprite by UID. Then you can do what ever you want to it - without having to loop through other instances. You can also pass the Sprite2 UID into a function and pick it as well. (trying to pick it using Pick Nearest doesn't work, but picking it directly by its UID does work).