When you're comparing the variables, each object is comparing with itself.
To compare values of two different instances of the same object you either:
1 put the object type in a family so you can pick two separate instances independently. Ex:
For each sprite
For each family1
Sprite.value < family1.value
2 pick one object, save its value to a variable and then "pick all" and pick the other instance.
3 use the sprite(0).value expression where 0 is the instance number. That way you can access separate instances from the same expression. You will need to loop over each pair of instances though.
What I usually opt to do for sorting like you're doing is just to use a "for each ordered" condition which will do the sorting for you.
For each sprite ordered by sprite.z acending
--- sprite: move to front