To toggle between two different onActivate events, you can place them into functions to change the behaviour whenever the man is clicked.
Show code in action
How the code works
- The function bindSpeakOn creates an onActivate event for man-item. When the man-item is clicked, the man says something and the function bindSpeakOff is triggered.
- The function bindSpeakOff creates an onActivate event for man-item, which overwrites the previous onActivate event. When the man-item is clicked, we remove the phrase and the function bindSpeakOn is triggered.
Outside of the two events we place one bindSpeakOn function block to set the first event when the scene starts.
I hope that this code can help you!