Physics Linecast

How does this work, because using it like this doesn’t work: (Because it’s always false)

    if (!Physics.Linecast(transform.position, player.transform.position)) {
	    if (target != null) {
		    if (Vector3.Distance(transform.position, target.position) <= Vector3.Distance(transform.position, player.transform.position)) {
		    	target = player.transform;
		    }
	    } else {
	   	target = player.transform;
	    }
    }

I found the issue, I had a sphere that was transparent from the outside, so I didn’t notice it, but the raycast was hitting that instead. I simply had to set it to ignore Raycast, and that was it but thx @HashGrove, for the help