[SOLVED] Tween doesn't work as expected when using signals

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

PROBLEM SOLVED:

After further research I duplicated the Tween node and made the first one call the second, then the second call the first. It’s looping fine now, here’s my code if you run into the same problem.

func pulse_outline():
	scrollMaterial.shader = load("res://Shaders/outline.shader")
	scrollMaterial.get_shader_param("outline_thickness")
	
	$ScrollShaderTween1.interpolate_property(scrollMaterial, "shader_param/outline_thickness", tweenValues[0], tweenValues[1], 1, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
	$ScrollShaderTween1.start()
	
func _on_ScrollShaderTween1_tween_completed(object, key):
	scrollMaterial.shader = load("res://Shaders/outline.shader")
	scrollMaterial.get_shader_param("outline_thickness")
	
	$ScrollShaderTween2.interpolate_property(scrollMaterial, "shader_param/outline_thickness", tweenValues[1], tweenValues[0], 1, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
	$ScrollShaderTween2.start()
	
func _on_ScrollShaderTween2_tween_completed(object, key):
	pulse_outline()

Hi everyone. I have a Tween that works this way:

func pulse_outline():
    scrollMaterial.shader = load("res://Shaders/outline.shader")
    scrollMaterial.get_shader_param("outline_thickness")
    
    $ScrollShaderTween.interpolate_property(scrollMaterial, "shader_param/outline_thickness", tweenValues[0], tweenValues[1], 1, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
    $ScrollShaderTween.start()
    
func _on_ScrollShaderTween_tween_completed(object, key):
    tweenValues.invert()
    $ScrollShaderTween.interpolate_property(scrollMaterial, "shader_param/outline_thickness", tweenValues[0], tweenValues[1], 1, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
    $ScrollShaderTween.start()

Basically, when the Tween stops, it sends a signal to start over with inverted values, to make it loop.

When I put pulse_outline() in func _ready(), it works perfectly. However when I decide to put it my signal func _on_CameraTween1_tween_completed(object, key):, the values stop inverting like it says in my code. Any help would be greatly appreciated!