there could be a if query, if the player is there every time.
I don't understand what you mean. The Y positions of the cubes are randomly generated with no connection to the Y position of the player.