I've successfully made the basics for a custom timer using the following script:
I have a LastUnpaused value that tracks the value that the global timer displayed when it was last unpaused. When the paused variable is set to true, this value is repeatedly updated to match the global timer.
How would I modify the math block in the block to take into account this value and make sure the timer continues from where it previously left off when the paused variable is switched to false?
Or is my method of pausing not a good one and should be swapped out for something else?
I wouldn't continually change the contents of your timer object, which means your timer needs continual maintenance. Instead, when you pause and unpause the timer, update the offset of your timer from the system timer.
So, change the name of your "TimeElapsed" variable to "TimeOffset" and start the timer by setting it equal to the value reported by TIMER. Change "LastUnpaused" to "LastPaused." Then, when pausing the timer, set LastPaused to TimeOffset; when unpausing, set TimeOffset to umm this takes some careful thinking, but I think it's
TimeOffset + (TIMER - LastPaused). Because when you want to know your timer value, you'll compute TIMER-TimeOffset, so pausing should increase the offset you'll later subtract from TIMER.
TL;DR: The values you store in your timer shouldn't be absolute times, but rather times relative to TIMER.