How to move object on canvas

Please I have an animated coin spinning at the top corner of my canvas. I need help in moving this coin with the mouse on right click. They don’t necessarily need to be in the same position (the mouse being over the coin) as I just need the transform position of the coin to translate with that of the mouse. Many scripts I found moved the coin in 3d and the coin gets left behind when I move my character forward but I need it to remain planar (moving only in x and y like on the canvas). By the way, my canvas uses a secondary camera. The last script I tried took the coin out of sight

private Vector3 mousePosition;
public float moveSpeed = 0.1f;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
if (Input.GetMouseButton(1)) {
mousePosition = Input.mousePosition;
mousePosition = Camera.main.ScreenToWorldPoint(mousePosition);
transform.position = Vector3.Lerp( new Vector3 (transform.position.x , transform.position.y, -5), mousePosition, moveSpeed);
}

}
A solution would be very much appreciated. Thank you.

Found a way around this. For anyone wanting to do this;

float speed = 2.0f;

void Update() {
var move = new Vector3(Input.GetAxis(“Mouse X”), Input.GetAxis(“Mouse Y”), 0);
transform.position += move * speed * Time.deltaTime;
}

I’m not sure you’re going to get someone to just give you a script that solves all your problems, but if you do it’ll be over in the “Scripting” forum, not here in General Discussion.