respawning

i have a plane above ground at startup (in the plane script i set gravity scale to zero at the startup when press enter i set it to 1) when it collides with the ground it respawns to the initial position but it falls to the ground again and again after respawning,i want it to be the exact same way as it was at the startup, staying above the ground and when press enter it should move again.i dont want to load the scene again.

i put this script on the ground-

public class dying : MonoBehaviour {
[SerializeField]Transform spawnpoint;

void OnCollisionEnter2D(Collision2D col)
{
	if (col.transform.CompareTag ("Player"))
		col.transform.position = spawnpoint.position;
		}

}
im a complete novice i really dont know much about coding, if you could show me how its done its a big help.

Copy the location of your plane and paste the coordinates into “spawnpoint”. This will ensure that your plane will always respawn at the same point. If you don’t want your plane to be affected by gravity, go into the rigidbody settings and disable gravity. Hope this helps.

@Sir-Magic
i did that, but my plane didn’t go to the way it was at the beginning.

You could reload the Scene if that wouldn’t cause any other problems, you would have to include UnityEngine.SceneManagement
so something like

using UnityEngine.SceneManagement;
    
     void OnCollisionEnter2D(Collision2D col)
     {  
          if (col.transform.CompareTag ("Player"))
                 SceneManager.LoadScene("YourSceneHere");
      }