How to set up a button to be pressed once rather than held?

so i’m starting my game by setting up movement speeds, and there’s different movement speeds bound to different keys, for example if you press z it makes you trot and holding down shift will make you jog.

holding down shift to jog is fine, but i’ve noticed that it’s rather difficult to keep the z key held down to trot, or holding down shift and x to sprint. i figured i’d change it to make it so, for example, you can press z once and be trotting, and press z again to stop, that way you don’t have to hold it down. i’ve tried to figure this out with input controls but it doesn’t seem to work, how do i go about this?

You could do this kind of thing:

You could do this kind of thing: