How to do scene transition. but theres a catch

Godot Version

4.6

Question

i wanted to do a scene transition where if you clicked inside the collisionshape of an area2d you would go to other scene. the thing is that i know how to do that.

*The catch is that when you click at this same input to go back to the first world it goes to the original location where the player was originaly  brfore moving but i wanted to make that when you clicked the input inside the area2d to go back to the first scene mentioned you would be at the same position you were before clicking to go to the second scene mentioned.*
could someone help me?

So the issue isn’t scene transition, but saving state across scenes. The easiest way is to set a global var with the last player position. Figure out in each scene whether to move the player to the location in the global var, or not.

idk exacly how going to do this buti will try later