in the game script, you can use the loop event to affect things every frame. for example, the game script might read something like:
on start do
timer = 20 //twenty second timer
end
on loop do
tick++
if tick>=20 then
timer-- //reduces timer by 1
tick = 0 //resets tick
if timer<=0 then
fin "Time's up!"
end
end
end
This would just start a simple timer right at the start of the game which counts down every second, then triggers a game over when time is up and restarts.