# Prevent gateway tag change script from running on startup

**URL:** <https://forum.inductiveautomation.com/t/prevent-gateway-tag-change-script-from-running-on-startup/42892>\
**Category:** Ignition\
**Created:** [February 2, 2021, 4:49pm UTC](https://forum.inductiveautomation.com/t/prevent-gateway-tag-change-script-from-running-on-startup/42892 "2021-02-02T16:49:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rusty](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/rusty/32/19859_2.png) [@Rusty](https://forum.inductiveautomation.com/u/Rusty)\
**Post date:** [February 2, 2021, 4:49pm UTC](https://forum.inductiveautomation.com/t/prevent-gateway-tag-change-script-from-running-on-startup/42892/1 "2021-02-02T16:49:14Z")

</div>

Hello,

Is there any way to prevent a gateway tag change script from running on startup? The issue is that every time I save my changes in the designer, it restarts the gateway scripts and although the tag value hasn’t changed, the gateway tag change script gets ran. The only change trigger active is the value checkbox.

Thanks

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [February 2, 2021, 4:51pm UTC](https://forum.inductiveautomation.com/t/prevent-gateway-tag-change-script-from-running-on-startup/42892/2 "2021-02-02T16:51:46Z")

</div>

No, but you can check the `initialChange` flag, which should be set the first time the script runs after startup or after a save or edit.

---

<div class="post-metadata">

**Author:** ![Rusty](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/rusty/32/19859_2.png) [@Rusty](https://forum.inductiveautomation.com/u/Rusty)\
**Post date:** [February 2, 2021, 4:58pm UTC](https://forum.inductiveautomation.com/t/prevent-gateway-tag-change-script-from-running-on-startup/42892/3 "2021-02-02T16:58:32Z")

</div>

> [@Kevin.Herron](#):
>
> initialChange

Thanks Kevin, that's perfect!

```auto
if not initialChange:
 
    # run script here

```

---

<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:** [February 2, 2021, 5:53pm UTC](https://forum.inductiveautomation.com/t/prevent-gateway-tag-change-script-from-running-on-startup/42892/4 "2021-02-02T17:53:33Z")

</div>

IIRC, there’s a small window of time during the updates to the project where the old change event is disconnected and the new one is set up. I consider the `initialChange` flag to be a _hint_ that it _might not_ have changed, and examine reliable state (DB, usually) to verify. When a lost event matters, that is.

---

<div class="post-metadata">

**Author:** ![AMavros](https://avatars.discourse-cdn.com/v4/letter/a/94ad74/32.png) [@AMavros](https://forum.inductiveautomation.com/u/AMavros)\
**Post date:** [July 19, 2023, 5:16pm UTC](https://forum.inductiveautomation.com/t/prevent-gateway-tag-change-script-from-running-on-startup/42892/5 "2023-07-19T17:16:37Z")

</div>

Hey trying this now on 8.1.23 and the change script is still executing on gateway startup, possible bug or am I missing something?
