how do I set my players position when chanige a secene I am making a metroid venia game

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

here is my code

func _on_cave_entrance_body_entered(body):
if body.name == “Player”:
set_global_position(Vector2(37.953, 105.833))
get_tree().change_scene(“res://cave.tscn”)
for the scene changing

:bust_in_silhouette: Reply From: njamster

If you call set_global_position you set the position in the current scene. So if you switch the scene afterwards the information will be lost. Instead store the information in an AutoLoad (that isn’t switched out when changing the scene) and only apply it after the level has been loaded, i.e. in the level’s _ready-function. See here.