maybe this is obvious, but, you'll probably want the time to restart with each input, no? So, in addition to Tulamide's events:
+Every 1ms: Add 1ms to "timer"
->On Any Key Pressed: Set Timer to 0
This way, the player isn't interrupted and reset in the middle of the game, but once they stop playing, the counter won't be reset and will trigger the "go to "titlescreen" action.
I know what you're aiming for, and it is a good idea, but that code won't work. Timer is a system expression and you can't go faster than the current frame rate with "every x milliseconds" (and I doubt the game will run with solid 1000 fps all of the time) and key pressed is a trigger, not an action.
But you can do it by adding a global variable ("currenttime")
+ System: Always (every tick)
-> System: Add TimeDelta to global variable 'currenttime'
+ MouseKeyboard: On any key pressed
-> System: Set global variable 'currenttime' to 0
+ System: Is global variable 'currenttime' Greater or equal 30
-> System: Go to layout "titlescreen" with transition "None" lasting 0 MS
Note that you have to compare 'currenttime' to seconds, not milliseconds, if you want to use this method.