Unable to create successful timer

var time = 0;
onEvent(“button3”, “click”, function( ) {
timedLoop(1000, function() {
time = time + 1;
function stopTime() {
onEvent(“btnkns8”, “click”, function( ) {
setText(“Time”, "Time: " + time);

I except the timer to run in the background once the button is pressed (I’ve consoled logged it and it displays there). Once the final button is pressed it’s supposed to display “Time: Amount of seconds” showing the player how long they took to complete the task.

What happens is the timer runs in the background (also in console log) but does not display at the end of the tasks just showing “Time: 0”

@JamesJohnson Looks like you were able to figure it out. At least it’s working when I try it.