How to make enemy`s gun shoot directly on player and its allies from some distance.

I have and 3d model of enemy with gun and its animation I want to make that the enemys gun shoot directly on player from further distance at a place. And yes it fire my players allies soldier, also it fire on player and its allies by raycasting and ray directly hits the player and its allies.
Please help me!
Thanks in advance.

Good day @AshwinTheGammer !

What is your problem exactly? I see you know need to use Raycasting, so if you know how to use Raycasting, I dont get what you need to know.