Countdown timer

Creates a Countdown timer from 30 seconds starting at button press

When I run this, my timer stops at 20 (starts at 30, counts down, and doesn’t go lower than 20). Is this an error? Is there something in the code I’m missing?

Also, is there a way to force a student to the next page if the timer gets to zero?

Nice catch! Since this example was made, timeSincePress has been updated to increase until a set value with a default of 10 seconds.

adding a number in the ( ) will set the max timer. in this case timeSincePress(30)

For your second question, no we can’t force a student on to another screen. However, you can set things up on your screen to disable or hide once a certain time has been reached.

Thank you for the fast and helpful response. I was a bit worried this was an old post and not monitored anymore. :slightly_smiling_face:

I tried to use this code, and the timer still stopped at 20 seconds even with the timesincepress (30) in the code. What am I doing wrong?

It’s hard to tell what the problem might be without the exact snippet of code that was used, but it needs to look just like this, where button is the name of the button component.

button.timeSincePress(30)

Even @Jay 's stops at 20 seconds when I checked.

I just looked at the code and it wasn’t updated to include the 30 second timer, which is why it’s stopping at the default. I changed it to stop at 30 seconds and it worked as intended.