Changing global position when switching scenes doesn't work correctly

Godot Version

4.5.1.

Question

I’ve been trying to make rooms for my game where I can walk into specific doors and load specific room-scenes. The problem I’m having is that when changing the scene, the player’s global_position isn’t set to be the correct one. It always ends up being the first global_position to have been set and doesn’t acknowledge the other entrance markers at all. Also, I used Marker2Ds as the targeted “entrance”s of where I want the global_position to be.

Here’s the code for positioning the player:

And for a bit more info, if anyone is interested, I believe I was following the tutorial “How to CHANGE SCENES in Godot” on Youtube by MakerTech.

https://youtu.be/sKqtCc_HykM?si=8jDbNPeGxKdvizRp

Some other people in the comments seemed to have the same problem too. My first idea was that the problem MIGHT stem from the tutorial being made for 4.2.1. but either way, I’m not sure how to fix it myself.

It looks like that if the entrance name is “world”, it will set the player’s position to there regardless of what the last scene was.