Select the lowest value among the same objects

I’m making a game similar to a rhythm game and I want the player to press Z to delete the frontmost note and then press it again to delete the new leading note

We might need more info. Are the “notes” moving like Guitar Hero and others? You can check the x or y value of the object depending on the direction they were moving and either delete any objects whose x or y is greater or less than a certain number or use 2 conditions to create a range x>10 with X<50.

It is similar to Guitar Hero, but if you press the Z key, that is, hit the note, the front note disappears wherever it is and moves to the next note.

maybe this example image will be self explanatory:
asdsı

Edit: I’m still unsure. What do the symbols represent and how do they interact? Are any of them moving?

I think you could use the pick nearest object. You can use a fixed point or one of your objects. For this I just used a NewSprite placed at the edge ahead of the direction the notes I’m assuming are moving.