How to wait in Godot 4: "yield" was removed, use await

By Eduardo Orellana · Updated

Godot 4 waits with await: await get_tree().create_timer(0.5).timeout pauses the function for half a second and then carries on. The Godot 3 way, yield(get_tree().create_timer(0.5), "timeout"), no longer parses: Godot 4 rejects it with "yield" was removed in Godot 4. Use "await" instead.

What Godot is checking

yield is gone from GDScript 2.0. The parser recognises the old call and stops with an error that names its replacement, so the script never loads and none of it runs.

await takes a signal or a call to a function that awaits. get_tree().create_timer(0.5) returns a SceneTreeTimer, and its timeout is a signal, so await get_tree().create_timer(0.5).timeout suspends the function until the timer fires. The rest of the game keeps running while it waits.

A function that awaits becomes a coroutine. Whoever called it carries on at once unless it awaits the call as well: await my_function().

Reproduce it

A Godot 3 wait, in a Godot 4 project. The scene is one Node with this script.

extends Node

func _ready():
	print("start")
	yield(get_tree().create_timer(0.5), "timeout")
	print("0.5 s timer finished")

What Godot 4.7.2 prints

Godot Engine v4.7.2.stable.mono.official.ed1daf0bf - https://godotengine.org

SCRIPT ERROR: Parse Error: "yield" was removed in Godot 4. Use "await" instead.
   at: GDScript::reload (res://answers/wait-in-godot-4-await-instead-of-yield/repro.gd:5)
ERROR: Failed to load script "res://answers/wait-in-godot-4-await-instead-of-yield/repro.gd" with error "Parse error".
   at: load (modules/gdscript/gdscript_resource_format.cpp:46)

Fix it

Await the timer's timeout signal. The run is at a fixed 60 frames per second, so it also prints the frame the wait ended on: 30 frames is 0.5 s.

extends Node

func _ready() -> void:
	print("start")
	await get_tree().create_timer(0.5).timeout
	print("0.5 s timer finished on frame ", Engine.get_process_frames())
	get_tree().quit()

What the fixed script prints

Godot Engine v4.7.2.stable.mono.official.ed1daf0bf - https://godotengine.org

start
0.5 s timer finished on frame 30

Waiting for any signal, not only a timer

Godot 3's yield(object, "signal_name") becomes await object.signal_name in Godot 4: await $Button.pressed, await $AnimationPlayer.animation_finished. The signal is a property of the object now, not a string.

Waiting with a Timer node

A Timer node in the scene works the same way: start it, then await its timeout signal. Use it when the wait should be visible in the scene tree or reused.

Verified on Godot 4.7.2

Both scripts on this page were run headless on Godot 4.7.2 (4.7.2.stable.mono.official.ed1daf0bf) on 6 October 2026, and the output above is what Godot printed, unedited.

Where the check lives in Godot's source: [gdscript_parser.cpp line 3851, the message](https://github.com/godotengine/godot/blob/4.7.2-stable/modules/gdscript/gdscript_parser.cpp#L3851), [SceneTree.create_timer in the class reference](https://github.com/godotengine/godot/blob/4.7.2-stable/doc/classes/SceneTree.xml).

Questions

Is there a wait() or sleep() function in Godot?
Not one that keeps the game running. OS.delay_msec() exists but blocks the whole engine for that long. For a wait inside game logic, await a timer as shown here.
Does await stop the whole game?
No. Only the function that awaits pauses. Rendering, physics and every other script keep running, which is why the fixed run reaches frame 30 before the timer ends.