The problem is that when you click on the undo button, the very first event also fires on the next frame as you’ve just started a new touch or mouse button down event. So the variable CurrentId is getting decreased and then immediately increased.
The solution is to add another condition to your first event, checking that the mouse/cursor isn’t over the NewObject3 (and as an aside, I suggest you give the objects decent/descriptive names. It took me a while to realise what NewObject3 is and what it’s supposed to be)
Also, the check of “The variable Id of NewObject = Variable(CurrentId)” in the second to last event can be removed. Just checking “NewObject is clearing its rendered image between each frame” is enough (and again, give NewObject a descriptive name).