Automatic running at button press

I am trying to create an automatic running system like in Dragon quest XI and Xenoblade Chronicles Definitive edition where when you press a button you start running automatically and you stop when pressing the same button, does anyone know how to do this

A generic basic gate could look like this:

Hard to advise more precisely since you did not specify how you actually move.