Why _on_AnimatedSprite_animation_finished() not work?

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

Hello everyone! I have an animated animation of AnimatedSprite2d in which my character begins to run 2 frames, and what I want is that as soon as this animation ends, another one starts in a loop but it does not work, the first animation instead of ending simply loops itself, I ask for your help, here is my code

func _on_AnimatedSprite_animation_finished(): 
	if ($AnimatedSprite.animation == "run"):
			$AnimatedSprite.play("running")
			

func anim_ctrl():
	if velocity.x > 0:
		$AnimatedSprite.flip_h = false
		$AnimatedSprite.play("run")
	elif velocity.x < 0:
		$AnimatedSprite.flip_h = true
		$AnimatedSprite.play("run")
	else:
		$AnimatedSprite.play("idle")
:bust_in_silhouette: Reply From: kareem_farrag

I think it will not finish because it is loop (run animation )

So disable run loop (when run finish it will play running )