2D platformer respawn problems

I’ve been making a 2D platformer I unity with c# and I followed SpeedTutors video on Dying and Respwaning. But when ever any object touches the “Death Box” the player is teleported.
Does anyone know how to fix this?

Here’s the code I’m currently using:

[SerializeField] private Transform Player;
[SerializeField] private Transform RespawnPoint;

void OnTriggerEnter2D(Collider2D other)
{
    Player.transform.position = RespawnPoint.transform.position;
}

you’ll need a check to see if the player entered is the player

something along the lines of

//checks against its name - must be player on this case
    void OnTriggerEnter2D(Collider2D other)
     {
    if(other.name == "Player") //change player to whatever your player is called
    {
         Player.transform.position = RespawnPoint.transform.position;
    }
    
     }

or

//checks against a tag
    void OnTriggerEnter2D(Collider2D other)
     {
    if(other.tag== "Player")
    {
         Player.transform.position = RespawnPoint.transform.position;
    }
    
 }