Is it possible that you have one of those crazies somewhere:
And literally flood the latency system?
The issue is not with the script you had.
the variable it goes blank when it reaches 10, 5, or 4
Blank as in there’s no value?