create a global variable isSlowMo = 0
Suppose you wanna toggle slowmotion with spacebar.
if keypress spacebar:
if isSlowMo = 0
> set global variable isSlowMo to 1
> set time scale to 0.5.
else
> set global variable isSlowMo to 0
> set time scale to 1
This event will toggle between normal time and slow motion by pressing spacebar.