# "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.

Source: https://flockbay.com/godot/wait-in-godot-4-await-instead-of-yield/ · Updated 2026-10-30

## 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
```

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

```
"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](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.

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

Download Flockbay free: Flockbay's agent reads Godot's debugger output and fixes errors like this one in your project, on the official Godot. https://flockbay.com/download/

Related: [Trying to call an async function without "await" in Godot 4](/godot/trying-to-call-an-async-function-without-await/), [How to connect signals in code in Godot 4: signal.connect(callable)](/godot/how-to-connect-signals-in-code-in-godot-4/), [How to tween in Godot 4: create_tween() and tween_property()](/godot/how-to-tween-in-godot-4/), [The "onready" keyword was removed in Godot 4: use @onready](/godot/onready-keyword-removed-in-godot-4/), [The "export" keyword was removed in Godot 4: every export(...) and its @export annotation](/godot/export-keyword-removed-in-godot-4/), [Every verified Godot 4 answer](/godot/), [How do I connect Claude Code to Godot?](/docs/how-do-i-connect-claude-code-to-godot/)
