Fix
Godot 4 setget, Tween.new, and @tool
Answer
In Godot 4 property accessors use the GDScript 2.0 get: and set(value): blocks, not setget. Animate with create_tween(). Do not create a Tween node with Tween.new(). Mark editor scripts with @tool on the first line, and check Engine.is_editor_hint() inside them.
- Godot 4.7.2-stable (18 August 2026)
- GDScript 2.0
Last verified 2026-10-15
Agents still paste Godot 3 syntax into a Godot 4 script after they have stopped writing KinematicBody2D. The misses that are not the body rename are setget, Tween.new(), and an editor script with no @tool check. The Godot 4 pack is written to stop that paste. It is pinned to Godot 4.7.2-stable (18 August 2026) and GDScript 2.0. The other fix page copies the ban list from the rules file. This page is the typing and timing section of that same file, plus the project files the scenes section tells you not to delete.
Property accessors use the GDScript 2.0 get: and set(value): blocks, not setget. Use static types on variables, parameters, and return values (var hp: int = 10, func hit(n: int) -> void). Use := only when the type is obvious from the right side. @export is for designer-facing values only. Give it a type and a default. Put gameplay code on the node that owns the behavior. Use @onready to cache child nodes. Do not call get_node() every frame.
Animate with var tween := create_tween(). Do not create a Tween node with Tween.new(). The call returns the tween you animate with. It is not a node you construct with Tween.new(), and it is not a row in the rename table. var tween := create_tween() uses := because the type is obvious from the right side, which is the typing rule in the same section.
Mark editor scripts with @tool on the first line, and check Engine.is_editor_hint() inside them. Both are required by the pack. Do not delete .godot/, project.godot, .import, or .uid files. Do not hand-edit .import files. The done checklist is the Godot editor shows no parser errors on the edited scripts, nothing from the ban list appears in the diff, and you said whether the scene was actually run.
Last verified 2026-10-15. doc-verified; GDScript sample parsed by Godot 4.7.2 headless (--check-only), with a Godot 3 control script correctly rejected.
Godot 4 pack — GDScript 2.0 rules that refuse Godot 3 APIs.
doc-verified; GDScript sample parsed by Godot 4.7.2 headless (--check-only), with a Godot 3 control script correctly rejected
Sources in the pack
Questions
- What replaces setget, Tween.new(), and a bare editor script in Godot 4?
- In Godot 4 property accessors use the GDScript 2.0 get: and set(value): blocks, not setget. Animate with create_tween(). Do not create a Tween node with Tween.new(). Mark editor scripts with @tool on the first line, and check Engine.is_editor_hint() inside them.
- What replaces setget in Godot 4?
- Property accessors use the GDScript 2.0 get: and set(value): blocks, not setget. Use static types on variables, parameters, and return values.
- What replaces Tween.new() in Godot 4?
- Animate with create_tween(). Do not create a Tween node with Tween.new(). A typed local is var tween := create_tween(), because the type is obvious from the right side.
- When was this Godot 4 typing rule last checked?
- Last verified 2026-10-15. doc-verified; GDScript sample parsed by Godot 4.7.2 headless (--check-only), with a Godot 3 control script correctly rejected.