Step 1 – Create a new variable called “timer”.
Step 2 – Make sure you have two backdrops for your stage (The main background for your game and a Game Over background).
Step 3 – Add the following code to your stage:
You can download this helpsheet as a pdf: How to create a timer in Scratch