Do you want to use the pawnsensing component or other solution will do?
I don’t know much about pawn sensing but the solution I would do is to use linetrace and trace it from my player to the pawns and check if something would hit before the pawns.
EDIT: Added my answer