Hi, i use this in a customized pet script and it work fine for me, the dog attack the ped that the player is aiming at but you need to add a function to detect which ped the player is aiming at.
The same kind of aiming detection i’m using: