Script on momentory button

Don't use a script. The momentary button drives it's .controlValue property, which you are expected to bidirectionally bind to the tag you want to control. In your case, with an indirect binding incorporating that tagpath property.

But beware, there are gotchas with momentary buttons in general, where you can lose the "off" operation. You generally need PLC code of some kind to mitigate this. See this topic and the linked topics within:

1 Like