Camera Following character that teleported

I’ve already created a “smooth” camera script to follow the character, the thing is i’ve added a teleport spot that teleports the character to another place (x,y) but the camera also “teleports” with him i want the camera to follow up like showing the road to him is it possible?

It’s a 2D game btw, thanks!

Script:

using UnityEngine;
using System.Collections;

public class CameraController : MonoBehaviour {

public Transform Player;

public Vector2
	Margin,
	Smoothing;

public BoxCollider2D Bounds;

private Vector3
_min,_max;

public bool isFollowing { get; set; }

	public void Start()
{
	_min = Bounds.bounds.min;
	_max = Bounds.bounds.max;
	isFollowing = true;
}

public void Update()
{
			var x = transform.position.x;
			var y = transform.position.y;

			if (isFollowing) {
					if (Mathf.Abs(x - Player.position.x) > Margin.x)
							x = Mathf.Lerp(x, Player.position.x, Smoothing.x * Time.deltaTime);

					if (Mathf.Abs (y - Player.position.y) > Margin.y)
							y = Mathf.Lerp(y, Player.position.y, Smoothing.y * Time.deltaTime);

			}

			var cameraHalfwidth = camera.orthographicSize * ((float)Screen.width / Screen.height);
			x = Mathf.Clamp(x, _min.x + cameraHalfwidth, _max.x - cameraHalfwidth);
			y = Mathf.Clamp(y, _min.y + camera.orthographicSize, _max.y - camera.orthographicSize);

			transform.position = new Vector3 (x, y, transform.position.z);

	}

}

Hello @StatecLata

You can directly use script which is provided by unity named “SmoothFollow”.
You will find this script by following
“Assets” tab → “Import Package” → “Scripts”.
And Add “SmoothFollow.js” this script attach to camera and give player as target.

Hope this will help you.