Auto shoot/Auto target NPC's

Hello, any help would be appreciated! I am looking to have my player auto shoot and auto target npc's as they are coming towards the player.. I know little LUA scripting..

                                                                                                                            Thanks.

So are you after aim assist or auto aim?

Aim assist would be similar to what console players get when playing shooters. Auto aim would be instant lock on to the target without needing the cross hair to be over the target.

Hello CommanderFoo,
I am looking something along the lines of auto aim with a player that shoots infinitely, sort of like archero on mobile.

There are a few ways you can do this. The easiest way would be rotate the player towards the enemy (assuming you are using the screen center point to shoot from). This gets a little more involved if the player and enemy are positioned at different Z levels, so you would then probably want to calculate the angle. Since you have the player position and enemy position, you can work that out.

A bit more involved would require raycasting to the enemy, this way you can check if anything is blocking the shooting path and handle different Z angles.

https://docs.coregames.com/api/world/

Might be best to study some code first, so maybe check out an asset by Aphrim in Community Content, I think he made something that does auto aim. Take a look at the code to see how he achieved it, and you should be able to adapt it to your needs.