Counter Retention

I have a variable assigned in my program to keep track of cycle counts. this way I can have the UR change boxes once there are 2500 parts in one box. Problem that I’m encountering is, if my robot errors out, or if the operator stops the robot mid box, when I go to restart the robot, my counts go back to zero. Is there a way to retain the count in those variable counters, so I can reference them on startup again?

Do you have that variable defined as an installation variable or just as a local variable within a script?
Installation variables should retain their values.
Do you have a line early in the program/BeforeStart section which resets it to zero? If so, you can query the operator whether it’s a new job, in which case you would clear the value, otherwise continue on with existing value.