Since it have a good rank on google i'll answer it, the reference documentation doesn't have an exemple and it require to understand signaling.
extends Control
var timer = null
# Called when the node enters the scene tree for the first time.
func _ready():
timer = Timer.new()
timer.set_one_shot(true)
timer.set_wait_time(2)
timer.connect("timeout", self, "on_timeout")
add_child(timer)
timer.start()
func on_timeout():
get_tree().change_scene("res://01_main_menu.tscn")
in timer.connect() the first argument is the signal (the only signal Timer is emitting is "timeout". Self it the receiver of the signal, and ontimeout is a function name of your choice, i called it "ontimeout" but could have been anything.
And in this function call the change_scene code.