can not get rect_global_position correctly with tween in loop

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By gamer1998
extends HBoxContainer

onready var tw = create_tween()
onready var Texture_Rect = get_node("../HBoxContainer/TextureRect")
onready var Another_Texture_Rect = get_node("../another_TextureRect")

func _ready():

func my_function():
	    for i in range(0,5):
		    var original_rect_global_position = Another_Texture_Rect.rect_global_position
		    var New_Texture_Rect = get_node("../HBoxContainer/TextureRect").duplicate()

What I’m trying to do is create a copy of the nodeTexture_Rect , then move Another_Texture_Rect node towards it a number of times , Instead, it moves in the same direction in each loop and print(New_Texture_Rect.rect_global_position) outputs does not change.

:bust_in_silhouette: Reply From: exuin

pretty sure you’re not using 3.5

anyway, you never change the position of new texture rect so why do you expect it to print differently?

also, you are trying to tween the same property twice