Skip to content

"yield" was removed in Godot 4. Use "await" instead: how to wait

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.

AppImage, x86_64. Ubuntu 22.04, Debian 12, Fedora 39 or newer.

Intel or AMD Chromebook, with Linux turned on.

Download for macOSDownload for WindowsDownload for Linux

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.

GDScript
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

Output
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.

More on this: How to connect signals in code in Godot 4: signal.connect(callable)

GDScript
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

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

start
0.5 s timer finished on frame 30

Run this fix with your agent

Flockbay is the Godot editor with an AI agent built in. Paste this into Flockbay's chat, or into Claude Code or Codex connected to Flockbay over MCP: the agent finds the cause in your project, applies the fix, runs the game headless and reads Godot's output to check it.

Prompt
"yield" was removed in Godot 4. Use "await" instead: how to wait 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. Where this calls for a change in my Godot 4 project, make it, then run the game headless and check Godot's output for errors.

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, SceneTree.create_timer in the class reference.

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.
What is a coroutine in GDScript, and why does my call return right away?
A function that contains await is a coroutine. At its first await it returns to its caller straight away, so the caller carries on at once unless it awaits the call too: await my_function(). Using a coroutine's return value without await is an error; at run time Godot prints Trying to call an async function without "await"., which has its own page.

Flockbay's agent reads Godot's debugger output and fixes errors like this one in your project, on the official Godot.

Download Flockbay free