# While Loop in Gateway Event Script

**URL:** <https://forum.inductiveautomation.com/t/while-loop-in-gateway-event-script/109166>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [July 30, 2025, 7:36pm UTC](https://forum.inductiveautomation.com/t/while-loop-in-gateway-event-script/109166 "2025-07-30T19:36:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kyle\_Young](https://avatars.discourse-cdn.com/v4/letter/k/d2c977/32.png) [@Kyle\_Young](https://forum.inductiveautomation.com/u/Kyle_Young)\
**Post date:** [July 30, 2025, 7:36pm UTC](https://forum.inductiveautomation.com/t/while-loop-in-gateway-event-script/109166/1 "2025-07-30T19:36:15Z")

</div>

So I goofed and wrote a bad while loop to turn a tag on. I realized my mistake and tried to stop it and even deleted the script but it is still running somewhere. I have since renamed the tag and it does not seem to be a problem. How do I find where this tag is still being written from and how do I stop it. Thank you.

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [July 30, 2025, 7:43pm UTC](https://forum.inductiveautomation.com/t/while-loop-in-gateway-event-script/109166/2 "2025-07-30T19:43:48Z")

</div>

Gateway webpage -\> Status -\> diagnostics -\> running scripts. Should give you an option to try and kill it. If it's still running regardless, the only other thing you can really do is shutdown and restart the gateway.

> **[Diagnostics - Running Scripts | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/platform/gateway/status/diagnostics-running-scripts)**
>
> The Running Scripts page shows all actively running Gateway scripts, as well as providing a way to terminate any running script. In addition, the Vision client and Designer consoles have a Running Scripts tab, which also lists running scripts and...

---

<div class="post-metadata">

**Author:** ![Kyle\_Young](https://avatars.discourse-cdn.com/v4/letter/k/d2c977/32.png) [@Kyle\_Young](https://forum.inductiveautomation.com/u/Kyle_Young)\
**Post date:** [July 30, 2025, 8:38pm UTC](https://forum.inductiveautomation.com/t/while-loop-in-gateway-event-script/109166/3 "2025-07-30T20:38:48Z")

</div>

THANK YOU!!!! That fixed it.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 30, 2025, 8:41pm UTC](https://forum.inductiveautomation.com/t/while-loop-in-gateway-event-script/109166/4 "2025-07-30T20:41:29Z")

</div>

I hope this has convinced you to not use `while` loops in event scripts, unless the condition is certain to become false in a deterministic way. (That is, not based on an external condition, only on data already present in the script.)
