Click the Events category.
Drag out a when clicked block and snap it on top.
Your script will start whenever you click the green flag:
Click the stop sign if you want it to stop.