Javascript is getting called multiple times. How to call it once and when we want

I am following the simple tank shooter tutorial in GDevelop 5 and I tried to use the javascript in GDevelop.

My confusion is that the javascript function runs multiple times repeatedly.I wanted it to be called once and whenever I wanted. How can this be done?

You can either put the JavaScript in a custom action or put it as a sub event of a normal event and use in that normal event the conditions you want (including trigger once)

1 Like

Thank you @arthuro555, it worked.