This thread may be relevant:
FYI I just tested the below tag change script using memory tags and couldn't get it to mess up on count regardless of how fast/many times I clicked on the triggering tag value checkbox in designer:
if currentValue.value and not previousValue.value:
count = system.tag.read('_Test/var1').value
tags = ['_Test/var1', tagPath]
values = [count + 1, False]
system.tag.writeAll(tags, values)
The not previousValue.value
check ensures this is not triggered by a quality change (doubt that's the issue you're having, but it's possible without this check). You may also want to add and not initialChange
.