The "export" keyword was removed in Godot 4: every export(...) and its @export annotation

By Eduardo Orellana · Updated

Godot 4 replaced the export keyword with annotations. export var speed = 200 is now @export var speed := 200, and each export(...) hint has its own annotation: export(int, 0, 100) is @export_range(0, 100), export(String, FILE) is @export_file, and so on. The fixed script below declares each one and runs on Godot 4.7.2.

What Godot is checking

GDScript 2.0 turned keywords that changed how a member is set up into annotations, written with @ before the declaration. The parser still recognises the Godot 3 export keyword so it can say what replaced it, and stops there: the script does not load, so none of its other errors are reported until this one is fixed.

The hint arguments that export(...) took became annotations of their own, and plain types moved into the type annotation: export(int) var lives is @export var lives: int, and export(Array, int) is @export var scores: Array[int].

Reproduce it

Two Godot 3 exports in a Godot 4 project. The parser stops at the first one.

extends Node

export var speed = 200
export(int, 0, 100) var health = 50

func _ready():
	print(speed, " ", health)

What Godot 4.7.2 prints

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

SCRIPT ERROR: Parse Error: The "export" keyword was removed in Godot 4. Use an export annotation ("@export", "@export_range", etc.) instead.
   at: GDScript::reload (res://answers/export-keyword-removed-in-godot-4/repro.gd:3)
ERROR: Failed to load script "res://answers/export-keyword-removed-in-godot-4/repro.gd" with error "Parse error".
   at: load (modules/gdscript/gdscript_resource_format.cpp:46)

Fix it

The same exports as Godot 4 annotations, plus one of each common hint, so this run checks every annotation named on this page.

extends Node

@export var speed := 200
@export_range(0, 100) var health := 50
@export_file("*.json") var save_path := ""
@export_multiline var notes := ""
@export_enum("Sword", "Bow", "Staff") var weapon := 0
@export_flags("Fire", "Water", "Earth") var elements := 0
@export_color_no_alpha var tint := Color.WHITE
@export var scores: Array[int] = []

func _ready() -> void:
	print("speed ", speed, ", health ", health, ", weapon ", weapon, ", tint ", tint)

What the fixed script prints

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

speed 200, health 50, weapon 0, tint (1.0, 1.0, 1.0, 1.0)

Every Godot 3 export and its Godot 4 annotation

The left column is Godot 3 and does not parse on Godot 4. The right column is what the fixed script above declares, so each one was run on Godot 4.7.2.

export var speed = 200                     ->  @export var speed := 200
export(int, 0, 100) var health = 50        ->  @export_range(0, 100) var health := 50
export(String, FILE, "*.json") var path    ->  @export_file("*.json") var save_path := ""
export(String, MULTILINE) var notes        ->  @export_multiline var notes := ""
export(int, "Sword", "Bow", "Staff") var w ->  @export_enum("Sword", "Bow", "Staff") var weapon := 0
export(int, FLAGS, "Fire", "Water") var e  ->  @export_flags("Fire", "Water", "Earth") var elements := 0
export(Color, RGB) var tint                ->  @export_color_no_alpha var tint := Color.WHITE
export(Array, int) var scores              ->  @export var scores: Array[int] = []

The other keywords that became annotations

The same change turned onready into @onready and tool into @tool. Godot 4 rejects each with its own parse error naming the annotation that replaced it.

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 1197, the message](https://github.com/godotengine/godot/blob/4.7.2-stable/modules/gdscript/gdscript_parser.cpp#L1197).

Questions

Why does nothing else in my script report an error?
A parse error stops the script from loading, so Godot reports the first one it meets. Fix the exports and the next problem, if any, shows up on the next run.