# The right way to limit gateway scripting?

**URL:** <https://forum.inductiveautomation.com/t/the-right-way-to-limit-gateway-scripting/38663>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [September 14, 2020, 6:18pm UTC](https://forum.inductiveautomation.com/t/the-right-way-to-limit-gateway-scripting/38663 "2020-09-14T18:18:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [September 14, 2020, 6:18pm UTC](https://forum.inductiveautomation.com/t/the-right-way-to-limit-gateway-scripting/38663/1 "2020-09-14T18:18:24Z")

</div>

I have a gateway message handler that does some extensive file scanning and folder structure work on the gateway server. I want to attach this to a button for an administrator, but also want to make sure that they cannot press or trigger it multiple times. I don’t even want two different admin users to be able to trigger it at the same time.

How could I accomplish this? I thought using some sort of lock boolean memory tag that would be turned on at the beginning of the script, and of at the end of the script/in case of error. But I was wondering if there was any other ways to handle this - limit how many instances of a gateway message handler can be running called at once?
