Okay guys, I've fixed it!
First I was sorting the objects using 'On Created', and I had a separate 'every 0.1 sec' event that updated the Z orders of the objects that are moving.
So, now instead of only updating the moving objects, I am updating all objects, and that's what fixed it
Thanks to everyone!