How to tween in Godot 4: create_tween() and tween_property()
By Eduardo Orellana · Updated
Make a tween from the node with create_tween() and animate a property with tween_property(): create_tween().tween_property(self, "position", Vector2(100, 0), 0.25). The Godot 3 Tween node is gone: Tween.new() prints Tween can't be created directly. Use create_tween() method., and interpolate_property() stops with Invalid call. Nonexistent function 'interpolate_property' in base 'Tween'.
AppImage, x86_64. Ubuntu 22.04, Debian 12, Fedora 39 or newer.
Intel or AMD Chromebook, with Linux turned on.
What Godot is checking
In Godot 4 a Tween is a RefCounted object owned by the SceneTree, not a node. create_tween() on a node makes one bound to that node: it pauses with it and stops when it is freed. The constructor refuses to make one.
A tween starts on its own on the next frame and runs its steps in order; .set_parallel() runs them together. Its finished signal fires when the last step ends.
Reproduce it
A Godot 3 Tween node, in a Godot 4 project.
extends Node2D
func _ready():
var t = Tween.new()
add_child(t)
t.interpolate_property(self, "position", Vector2.ZERO, Vector2(100, 0), 1.0)
t.start()
What Godot 4.7.2 prints
Godot Engine v4.7.2.stable.mono.official.ed1daf0bf - https://godotengine.org
ERROR: Tween can't be created directly. Use create_tween() method.
at: Tween (scene/animation/tween.cpp:551)
GDScript backtrace (most recent call first):
[0] _ready (res://answers/how-to-tween-in-godot-4/repro.gd:4)
ERROR: Required object "rp_child" is null.
at: add_child (scene/main/node.cpp:1715)
GDScript backtrace (most recent call first):
[0] _ready (res://answers/how-to-tween-in-godot-4/repro.gd:5)
SCRIPT ERROR: Invalid call. Nonexistent function 'interpolate_property' in base 'Tween'.
at: _ready (res://answers/how-to-tween-in-godot-4/repro.gd:6)
GDScript backtrace (most recent call first):
[0] _ready (res://answers/how-to-tween-in-godot-4/repro.gd:6)Fix it
A tween that moves the node 100 px right in a quarter second, eased, then reports.
extends Node2D
func _ready() -> void:
var tween := create_tween()
tween.tween_property(self, "position", Vector2(100, 0), 0.25).set_trans(Tween.TRANS_QUAD).set_ease(Tween.EASE_OUT)
await tween.finished
print("position ", position, " on frame ", Engine.get_process_frames())
What the fixed script prints
Godot Engine v4.7.2.stable.mono.official.ed1daf0bf - https://godotengine.org
position (100.0, 0.0) on frame 15Several steps, one after another
Each tween_property() call adds a step that starts when the previous one ends. tween_interval() adds a pause and tween_callback() calls a function.
var tween := create_tween()
tween.tween_property($Sprite2D, "modulate:a", 0.0, 0.5)
tween.tween_callback($Sprite2D.queue_free)
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 18 October 2026, and the output above is what Godot printed, unedited.
Where the check lives in Godot's source: [tween.cpp line 551, the message](https://github.com/godotengine/godot/blob/4.7.2-stable/scene/animation/tween.cpp#L551), [Tween in the class reference](https://github.com/godotengine/godot/blob/4.7.2-stable/doc/classes/Tween.xml).
Questions
- How do I stop a tween?
- Keep the Tween it returned and call kill(). Starting a new tween on the same property does not stop the old one.
- Can I tween one axis?
- Yes, with a property path: tween_property(self, "position:x", 100.0, 0.25).
Related
- How to wait in Godot 4: "yield" was removed, use await
- How to connect signals in code in Godot 4
- Every verified Godot 4 answer
- Invalid assignment of property or key '…' with value of type '…' on a base object of type 'Node2D' in Godot 4
- Cannot call method '…' on a null value in Godot 4
- Invalid assignment of property or key with value of type on a base object of type 'Nil' in Godot 4
- How to get the class name of a node in Godot 4: get_class() and get_global_name()
- Invalid access to property or key on a base object of type 'null instance' in Godot 4
Flockbay's agent reads Godot's debugger output and fixes errors like this one in your project, on the official Godot.
Download Flockbay free