# Multi-State Indicator mouse click read-write tag to toggle state

**URL:** <https://forum.inductiveautomation.com/t/multi-state-indicator-mouse-click-read-write-tag-to-toggle-state/66468>\
**Category:** Ignition\
**Tags:** ignition80, vision, scripting\
**Created:** [November 14, 2022, 2:17pm UTC](https://forum.inductiveautomation.com/t/multi-state-indicator-mouse-click-read-write-tag-to-toggle-state/66468 "2022-11-14T14:17:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![zachary\_larick](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zachary_larick/32/40740_2.png) [@zachary\_larick](https://forum.inductiveautomation.com/u/zachary_larick)\
**Post date:** [November 14, 2022, 2:17pm UTC](https://forum.inductiveautomation.com/t/multi-state-indicator-mouse-click-read-write-tag-to-toggle-state/66468/1 "2022-11-14T14:17:37Z")

</div>

I'm attempting to make it so when there is a mouse click on a multi-state indicator it toggles the state between 0-1 and writes this change to the tag.

---

<div class="post-metadata">

**Author:** ![zacht](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@zacht](https://forum.inductiveautomation.com/u/zacht)\
**Post date:** [November 14, 2022, 3:32pm UTC](https://forum.inductiveautomation.com/t/multi-state-indicator-mouse-click-read-write-tag-to-toggle-state/66468/2 "2022-11-14T15:32:37Z")

</div>

I bound the state of the multistate indicator to `'tagPath'` and used this script in the mousePressed event handler script. It seems to accomplish your goal.

```auto
system.tag.writeBlocking(['tagPath'],[not event.source.state])

```

You might also consider using a "Multi-State Button." I find these to be clearer for HMI users than a toggle. With toggles it's not always obvious that the button has an on-click behavior.

---

<div class="post-metadata">

**Author:** ![zachary\_larick](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zachary_larick/32/40740_2.png) [@zachary\_larick](https://forum.inductiveautomation.com/u/zachary_larick)\
**Post date:** [November 14, 2022, 4:27pm UTC](https://forum.inductiveautomation.com/t/multi-state-indicator-mouse-click-read-write-tag-to-toggle-state/66468/3 "2022-11-14T16:27:31Z")

</div>

I tried that script but it is giving me a Parse Error.

![Parse Error](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/f/8fec5524d3d0829025a5357f9799dd4e9472ab0a.png)

---

<div class="post-metadata">

**Author:** ![zacht](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@zacht](https://forum.inductiveautomation.com/u/zacht)\
**Post date:** [November 14, 2022, 4:30pm UTC](https://forum.inductiveautomation.com/t/multi-state-indicator-mouse-click-read-write-tag-to-toggle-state/66468/4 "2022-11-14T16:30:42Z")

</div>

Post a screenshot of the script.

The tagpath should be quoted. That may be your problem.

---

<div class="post-metadata">

**Author:** ![zachary\_larick](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zachary_larick/32/40740_2.png) [@zachary\_larick](https://forum.inductiveautomation.com/u/zachary_larick)\
**Post date:** [November 14, 2022, 4:35pm UTC](https://forum.inductiveautomation.com/t/multi-state-indicator-mouse-click-read-write-tag-to-toggle-state/66468/5 "2022-11-14T16:35:50Z")

</div>

Putting the quotes was in fact the issue. Thank you
