After one animation finished the second animation is not starting

Godot Version


the code?

I provided everything but I don’t know where did it go (yes I am new here) but I am describing this again.

I wanted a fade in and out transition when my scene reload but after many trials only fade in animation is playing than my scene reload but my fade out animation is not playing after that here is my code :-

extends Area2D

var speed = 10 # Adjust the speed of the lava
var fade_duration = 1
var reloading = false

func _process(delta):
position.y -= speed * delta

func _on_Area2D_body_entered(body):
if body.is_in_group(“player”) and == “Player” and not reloading:
reloading = true
print(“Fading in”)
yield($AnimationPlayer, “animation_finished”) # Wait for fade_in animation to finish
get_tree().reload_current_scene() # Reload the scene

func _on_AnimationPlayer_animation_finished(anim_name):
if anim_name == “fade_in”:
print(“Emit signal transitioned”)
if anim_name == “fade_out”:
print(“Finished fading”)

And yes my animation and animation name is setuped correctly and here is my debugger

editor/editor_settings.cpp:142 - EditorSettings::_get - Property not found: run/window_placement/screen
editor/editor_settings.cpp:142 - EditorSettings::_get - Property not found: run/window_placement/rect
Selected screen scale: 1.8
— Debugging process started —
Godot Engine v3.6.beta3.official.21ab700f2 -
OpenGL ES 2.0 Renderer: Mali-G76 MC4

Fading in
Emit signal transitioned
— Debugging process stopped —

Thank you for your kind help

the reason it’s not working because you reload whole scene tree after the animation player played fade_in

add code below after the play fade out code line

yield($AnimationPlayer, “animation_finished”)

I don’t know

change the " yeah, basically copy and paste the one you already have

With no indent

Oh sorry I totally missed that

dont take out the indent,
here the fixed one

yield($AnimationPlayer, "animation_finished")

I tried but still the problem remains

it’s just you wanted to play fade in then fade out, then reload the scene right?
you can just merge the fade in and fade out if that’s the case, or really move the reload scene code line after the new yield line

also it appears that you need another one indent to the right for get_tree().reload_current_scene() line
and the yield line also

I want to play the fade_in animation before scene reloads and fade_out animation after scene reloaded

then in _ready() code play the fade_out animation

Should I remove the yield code ?

yeah, for the new one you put into after the fade_out, also fix the your yield line of code for fade_in and reload_current_scene, it needs indent

Anything I have to do because still did not play the fade out (sorry I am still a beginner so don’t know all the basics)

what’s if your func _ready(): code block looks like

Sorry but I didn’t understand

this is what i mean,

here you add the play animation of fade_out instead