E2 making a command execute only once and not constantly from a toggle command.

So I am working on making a plane that when I press shift it toggles VTOL mode which I would need to reset the pitch and roll angles but not keep them constantly reset.
How would I do so with this code?



@inputs Button
@outputs A
if(Button & ~Button){
A = !A
}


Can anyone please help me?

This would probably be a bit more helpful.