Usually, the player does not move on the X-axis in an infinite runner. Everything else is moving.
Give the button a instance Boolean 'Switch'
On button clicked
____Sub .. Button > Is Boolean instance variable set ... 'Switch'
__________action .. Button > Set Boolean ... 'Switch' to false
__________All the other actions you need to switch direction
____Else
__________action .. Button > Set Boolean ... 'Switch' to true
__________All the other actions you need to switch direction