I can't figure out what is wrong with my code please help!(c#)

This is my first game so bare with me here… I am trying to make a puzzle game where the goal is to get to the next room. I have it set up so when the player presses the space bar when on top of the door, they are placed in the next scene(room). However, when you switch scenes, the player stays at the same position. I am trying to make a game object that when the player switches to the next scene, it teleports the player to the game object. Here is my code for the teleporter:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AreaEnterance : MonoBehaviour
{
    public string transitionName;
    public GameObject player;

    // Start is called before the first frame update
    void Start()
    {
        
        if(player.GetComponent<PlayerController>().areaTransitionName == transitionName)
        {
            player.GetComponent<PlayerController>().transform.position = this.transform.position;
        }
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}

And here is my code for the door:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class NextScene : MonoBehaviour
{
    public string areaToLoad;
    public string areaTransitionName;
    public GameObject player;

    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        
    }

    private void OnTriggerStay2D(Collider2D other)
    {
        if(other.tag == "Player" && Input.GetKeyDown(KeyCode.Space))
        {
            SceneManager.LoadScene(areaToLoad);

            player.GetComponent<PlayerController>().areaTransitionName = this.areaTransitionName;
        }
    }
    
}

I cannot figure out why the code isn’t working… please help!

Unless you have used DontDestroyOnLoad(), NextScene and the player will be destroyed when switching scenes. This will happen in between the line

SceneManager.LoadScene(areaToLoad);

and

player.GetComponent<PlayerController>().areaTransitionName = this.areaTransitionName;

so that there will no longer be a NextScene to run that second line or a player to run it on. An easy fix would be to place the player object into the second scene at exactly the place you want them to start at. You can use prefabs to easily copy the player from one scene to another, and then any changes you make later to one will apply to the other as well. Then you won’t need any code to move the player in the new scene!