I want to make game-like time travel, the player has the ability to go to the future by limited time, for that, I want to add some game mechanic like save the player position.

Additional information: ignore the red text. When pressing the button the player will create a new platform and immediately teleport to the original position. After the player teleported, the player will save the new platform as the new teleport position. after 2 seconds or pressing a button. the new platform will disappear and the player will return to the platform position.
I have this _playerController Script and I already implement the save position, but I don't know how to make it like what I explain.
public Rigidbody2D theRB;
public float speedMovement;
public GameObject prefabGameObject;
[Space(10)]
private BoxCollider2D boxCollider2D;
[SerializeField] private LayerMask GroundMask;
public float jumpVelocity;
[Space(10)]
public float past;
public float future;
[Space(10)]
public float hor;
// Start is called before the first frame update
void Start()
{
theRB = gameObject.GetComponent<Rigidbody2D>();
boxCollider2D = transform.GetComponent<BoxCollider2D>();
}
// Update is called once per frame
void Update()
{
PlayerPosSaveLoad();
PlayerMovement();
PlayerJump();
}
public void PlayerMovement()
{
hor = Input.GetAxis("Horizontal");
if (hor > 0 || hor < 0)
{
theRB.velocity = new Vector2(hor * speedMovement * Time.deltaTime, theRB.velocity.y);
if (hor > 0)
{
transform.localScale = new Vector2(1f, transform.localScale.y);
//Animation
Debug.Log("ToTheright");
}
else
{
transform.localScale = new Vector2(-1f, transform.localScale.y);
//Animation
Debug.Log("ToTheLeft");
}
}
}
public void PlayerJump()
{
//animation
if (isGrounded() && Input.GetKeyDown(KeyCode.Space))
{
theRB.velocity = Vector2.up * jumpVelocity;
}
}
public bool isGrounded()
{
float extraHeighText = .1f;
RaycastHit2D raycast2d = Physics2D.BoxCast(boxCollider2D.bounds.center, boxCollider2D.bounds.size, 0f, Vector2.down, boxCollider2D.bounds.extents.y + extraHeighText, GroundMask);
Color raycolor;
if (raycast2d.collider != null)
{
raycolor = Color.green;
}
else
{
raycolor = Color.red;
}
Debug.DrawRay(boxCollider2D.bounds.center, Vector2.down * (boxCollider2D.bounds.extents.y + extraHeighText), raycolor);
return raycast2d.collider != null;
}
[SerializeField]
private Vector2 saveThisPosition;
public void PlayerPosSaveLoad()
{
if (Input.GetKeyDown(KeyCode.E))
{
saveThisPosition = transform.position;
SpawnGameObject();
}
if (Input.GetKeyDown(KeyCode.Q))
{
SwitchWithsavedPosition();
Destroy(prefabGameObject);
}
}
private void SwitchWithsavedPosition()
{
Vector2 temp = transform.position;
transform.position = saveThisPosition;
prefabGameObject.transform.position = temp;
}
public void SpawnGameObject()
{
Instantiate(prefabGameObject, transform.position, transform.rotation);
}
And this is the Camera Script because connected with the player.
```lang-cs
public Transform Player;
// Start is called before the first frame update
void Start() { }
// Update is called once per frame
void Update()
{
transform.position = new Vector3(Mathf.Clamp(Player.position.x, -7.3f, 7.3f), Mathf.Clamp(Player.position.y, 1f, 2f), transform.position.z);
}