Trying To Find Mouse Position On Tap

I’m trying to see if I can move a trigger to where the characters taps/clicks. I’ve done lots of researching and looked over lots of other people who had a similar-ish problem, which eventually lead me to this; but the object now doesn’t move at all when I click.

public int TapDamage = 10;
Vector3 StartPos;
Vector3 p = new Vector3();
Camera c = Camera.main;
Event e = Event.current;
Vector2 mousePos = new Vector2();

private void Start()
    StartPos = gameObject.transform.position;

void MovingClickBox()

    if (Input.GetMouseButtonDown(0) == true)
        mousePos = Input.mousePosition;

        mousePos.x = e.mousePosition.x;
        mousePos.y = c.pixelHeight - e.mousePosition.y;

        p = c.ScreenToWorldPoint(new Vector3(mousePos.x, mousePos.y, c.nearClipPlane));

        gameObject.transform.position = mousePos;


private void FixedUpdate()



you’re overriding mousePos you just read the mouse position into completely. remove those lines.