Any tips to reset script?

Hello, I am currently learning LUA. I am working on a script where you have to decode a padlock basically. But the script needs to reset when closed down and start over. Most of the function is in javascript - so my question is if there may be a function that can also start the script over when basically not focused anymore?

Or should this be done in the javascript when the player is closing it down and reset it all in the javascript?

Thank you :slight_smile:

Hi,

What do you want to reset exactly? Some global variables?

If I understand, you have a client script in LUA and a NUI in html/css/javascript. If you want to reset something on your NUI, the best way itโ€™s to create a function and call it in the โ€œopenโ€ event.