what wrong with lerp.

using UnityEngine;
using System.Collections;

public class Mousedrag : MonoBehaviour {
	

	// Use this for initialization

	public Transform player;
	public float speed;
	void Start () {

	}
	// Update is called once per frame
	void Update () {
	if (Input.GetMouseButtonDown (0)) 
		{
			Debug.Log(Input.mousePosition);
			Vector3 newPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
			float yPos = newPos.y;
			player.position=new Vector3(player.position.x,yPos,player.position.z);

				player.position = Vector3.Lerp(player.position, yPos, speed);


		}
	}
}

Hi. You have to be specific when asking a question on this forum.
Don’t just post your script and ask people to correct it.
This is not how Unity Answers works.

Please read the Frequently Asked Questions and the User Guide.
This will help you to ask good questions later. :slight_smile:

Your code has some errors that prevent Unity from even starting the scene:
Vector3.Lerp() takes (Vector3, Vector3, float) and not (Vector3, float, float).

You declared yPos as a float.

If you look at the error in Unity, it will tell you that. :slight_smile:

Have a nice day.