the title speaks for itself , ply:GetEyeTrace or GetEyeTraceNoCursor cuz they didnt work
GetEyeTrace returns a table with many things. If you want to get what is the player looking at, use ply:GetEyeTrace().Entity.
More info here:
If you want to check if something is within a player line of sight, that would be a bit more complicated. Perhaps you’ll find the solution here: