I need to get the position in a vector3 of where my mouse is

im making a RTS and would like to find where the mouse is pointing so that I can place a building there ive tried raycasting and it seems to not work any suggestions?

void Update () {
    float hit;
    Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

    if (plane.Raycast(ray, out hit))
    {
        Transform objectHit = hit.GetPoint(hit);
        Debug.DrawRay(transform.position, objectHit.position, Color.red);
    }
}

Try use RaycastHit hit instead of float hit for your hit variable, then replace hit.Getpoint(hit) to hit.transform on line 7.