Vector3.Lerp not working too great.

I’ve been working on a basic chess game, and as part of the system I want the pieces to move around as if they’re being pushed, so I thought Vector3.Lerp would be perfect. I’ve used it before with few issues, but I thought I’d go on the safe side and get a script from here, which I’ve done before. However, instead of the piece moving smoothly from 'origin to ‘target’, it instantly teleport from one to the other. I get an error
‘transform.position assign attempt for ‘King’ is not valid. Input position is { NaN, NaN, NaN }.’ in line ‘Tiles:Move() (at Assets/Scripts/Tiles.cs:40)’, which I’m pretty sure is coming from ‘distCovered’ being 0 and messing the whole script up, but I have no idea how it coul be becoming 0, as it isn’t 0 at the end on the ‘On MouseDown’ function. Here’s my script:

public class Tiles : MonoBehaviour {

    public float journeyLength;
    public float startTime;
    static public bool moving = false;
    public float speed = 0.1f;
    private Color changeColor = new Color(0, 0.5f, 1, 0);

    void Update ()
        if (moving == true)

    void OnMouseDown()
        if (gameObject.GetComponent<Renderer>().material.color == changeColor)
   = this.gameObject.transform.position;
            Manager.origin = Manager.selected;
            Vector3 v3 = new Vector3(, Manager.origin.transform.position.y,;
   = v3;
            startTime = Time.time;
            journeyLength = Vector3.Distance(Manager.origin.transform.position,;
            moving = true;

    void Move ()
        float distCovered = (Time.time - startTime) * speed;
        float fracJourney = distCovered / journeyLength;
        Manager.selected.transform.position = Vector3.Lerp(Manager.origin.transform.position,, fracJourney);
        if(Manager.selected.transform.position.x == || Manager.selected.transform.position.z ==
            moving = false;

All I did was paste in the script from the above link and change the variables to be what I wanted.
Any help is greatly appeciated, sorry if this is a really nooby question, I couldn’t find an anwser anywhere :(.

This fixed the problem nicely, thanks to @doublemax , this works:

IEnumerator MoveObjectToPosition(Transform trans, Vector3 end_position, float duration)
        Vector3 start_position = trans.position;
        float elapsed = 0.0f;
        while (elapsed < duration)
            trans.position = Vector3.Lerp(start_position, end_position, elapsed / duration);
            elapsed += Time.deltaTime;
            yield return null;
        trans.position = end_position;