# Tag scripts not executing on valuechanged

**URL:** <https://forum.inductiveautomation.com/t/tag-scripts-not-executing-on-valuechanged/53159>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [November 16, 2021, 11:56pm UTC](https://forum.inductiveautomation.com/t/tag-scripts-not-executing-on-valuechanged/53159 "2021-11-16T23:56:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Glane](https://avatars.discourse-cdn.com/v4/letter/g/e95f7d/32.png) [@Glane](https://forum.inductiveautomation.com/u/Glane)\
**Post date:** [November 16, 2021, 11:56pm UTC](https://forum.inductiveautomation.com/t/tag-scripts-not-executing-on-valuechanged/53159/1 "2021-11-16T23:56:46Z")

</div>

Im having issues attempting to get this tag script to execute properly and write the current value to the last value tag, is it simply that this verison of ignition uses different syntax?

im trying to copy this from the “tag scripting” course on inductive university. Changing the value of the “newtag” string does nothing, i cannot get the script to properly run and move the values to the lastvalue.value.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/3/43bb9a6c4b11c74a435c64a5736212aa60b4600d.png)

---

<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:** [November 16, 2021, 11:58pm UTC](https://forum.inductiveautomation.com/t/tag-scripts-not-executing-on-valuechanged/53159/2 "2021-11-16T23:58:49Z")

</div>

You have a typo - `PreviousValue.value` instead of `previousValue.value`.

Everything is case sensitive in scripting.

---

<div class="post-metadata">

**Author:** ![Glane](https://avatars.discourse-cdn.com/v4/letter/g/e95f7d/32.png) [@Glane](https://forum.inductiveautomation.com/u/Glane)\
**Post date:** [November 17, 2021, 12:04am UTC](https://forum.inductiveautomation.com/t/tag-scripts-not-executing-on-valuechanged/53159/3 "2021-11-17T00:04:31Z")

</div>

Hmm still no dice

```auto
if currentValue.value != previousValue.value and initialChange == false:
		system.tag.writeblocking (['[default]LastValue'],[previousValue.value])

```

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/5/e5da8e4ee6425828f8150e795b30e0d6454d546d.png)

---

<div class="post-metadata">

**Author:** ![Glane](https://avatars.discourse-cdn.com/v4/letter/g/e95f7d/32.png) [@Glane](https://forum.inductiveautomation.com/u/Glane)\
**Post date:** [November 17, 2021, 12:10am UTC](https://forum.inductiveautomation.com/t/tag-scripts-not-executing-on-valuechanged/53159/4 "2021-11-17T00:10:09Z")

</div>

Nevermind, you were right it was a case sensitive typo on writeBlocking. thanks again.

Corrected code:

```auto
if currentValue.value != previousValue.value and initialChange == False:
		system.tag.writeBlocking (['[default]LastValue'],[previousValue.value])

```
