# Tag Event Change Script Issue - not initialChange

**URL:** <https://forum.inductiveautomation.com/t/tag-event-change-script-issue-not-initialchange/29081>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [October 14, 2019, 9:21pm UTC](https://forum.inductiveautomation.com/t/tag-event-change-script-issue-not-initialchange/29081 "2019-10-14T21:21:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![chelseajbenzie](https://avatars.discourse-cdn.com/v4/letter/c/ce73a5/32.png) [@chelseajbenzie](https://forum.inductiveautomation.com/u/chelseajbenzie)\
**Post date:** [October 14, 2019, 9:21pm UTC](https://forum.inductiveautomation.com/t/tag-event-change-script-issue-not-initialchange/29081/1 "2019-10-14T21:21:20Z")

</div>

Hi,  
I have a VERY basic tag event change script that I am trying to run and cannot understand why it does not work. All I am trying to do is write 0 to a memory tag when a certain tag value changes in the system. I also do not want it to run on an initial change.

```auto
def valueChanged(tag, tagPath, previousValue, currentValue, initialChange, missedEvents):
	"""
	Fired whenever the current value changes in value or quality.

	Arguments:
		tag: The source tag object. A read-only wrapper for obtaining tag
		     properties.
		tagPath: The full path to the tag (String)
		previousValue: The previous value. This is a "qualified value", so it
		               has value, quality, and timestamp properties.
		currentValue: The current value. This is a "qualified value", so it has
		              value, quality, and timestamp properties.
		initialChange: A boolean flag indicating whether this event is due to
		               the first execution or initial subscription.
		missedEvents: A flag indicating that some events have been skipped due
		              to event overflow.
	"""

	if not initialChange:
		system.tag.write("[.]../Daily Actuals/Starting Count.value",0)

```

That being said, here is the really easy piece of script that I wrote. It works when I remove the initial change if statement, but otherwise throws an error and creates a bad tag value.

Has anyone else experienced this before?

---

<div class="post-metadata">

**Author:** ![Paul.Scott](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul.scott/32/4578_2.png) [@Paul.Scott](https://forum.inductiveautomation.com/u/Paul.Scott)\
**Post date:** [October 14, 2019, 9:36pm UTC](https://forum.inductiveautomation.com/t/tag-event-change-script-issue-not-initialchange/29081/2 "2019-10-14T21:36:08Z")

</div>

Seems like the script should work. What does the error say?

---

<div class="post-metadata">

**Author:** ![Andrew.Zebic](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Andrew.Zebic](https://forum.inductiveautomation.com/u/Andrew.Zebic)\
**Post date:** [October 15, 2019, 5:37am UTC](https://forum.inductiveautomation.com/t/tag-event-change-script-issue-not-initialchange/29081/3 "2019-10-15T05:37:37Z")

</div>

If it’s Igntion 8, shouldn’t that be writeBlocking instead? Also might be a bit dumbon my end, but maybe just try an absolute path too?

---

<div class="post-metadata">

**Author:** ![chelseajbenzie](https://avatars.discourse-cdn.com/v4/letter/c/ce73a5/32.png) [@chelseajbenzie](https://forum.inductiveautomation.com/u/chelseajbenzie)\
**Post date:** [October 15, 2019, 12:47pm UTC](https://forum.inductiveautomation.com/t/tag-event-change-script-issue-not-initialchange/29081/4 "2019-10-15T12:47:34Z")

</div>

Bad\_NotFound

 ![Capture](https://us1.discourse-cdn.com/inductiveautomation/original/2X/0/0865f4b9d521d84186d1a6c0ef0cb10705aeeaf3.png)

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [October 15, 2019, 1:39pm UTC](https://forum.inductiveautomation.com/t/tag-event-change-script-issue-not-initialchange/29081/5 "2019-10-15T13:39:55Z")

</div>

Tag scripts run on the gateway, so you will need to specify the tag provider with an absolute path (as @Andrew.Zebic has already alluded).

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [October 15, 2019, 1:42pm UTC](https://forum.inductiveautomation.com/t/tag-event-change-script-issue-not-initialchange/29081/6 "2019-10-15T13:42:37Z")

</div>

> [@Andrew.Zebic](#):
>
> If it’s Igntion 8, shouldn’t that be writeBlocking instead?

system.tag.write() will still work, but it's deprecated in favor of writeBlocking().

I'll confess, if I'm writing a quick bit of code to test, I'll still use write(). Trying to overcome 10 years of habit. 🙂
