How to make a soldier AI

How do I make a soldier Ai?I have made some using creator hub and devforum but they dont work
How should i make it?

2 Likes

Well, the system you want a lot of knowledge about scripting so I will try to help:
First of you should know about
PathFinding
-You need to know this for pathfinding to players or other NPCs to kill/follow however when pathfinding things you should know about:
Pcalls
-Sometimes errors while path finding happens using pcalls will prevent these. Now you may ask for how NPC will dectect players around. For this you should use:
RayCasting
-You can create a loop by using run service and getting players near it. The reason you need raycasting is checking if NPC can see the player and checking if NPC’s way is correct so it can walk. When you learn about all of these you should use raycasting for AI to shoot enemies if your solider using swords you should use hitbox by raycasting or using :GetBoundingBox method on Sword or etc.
Now, there are still too many things to talk about like how NPCs will take cover or etc. for these I prefer asking more people at devforum since this was a summary of how you can make a basic NPC system. You should also research about modular programming for organization and multithreading for performance.

2 Likes

In addition to @doruktosunbas1 , if you want a idea on how code it, you can take a look at Y3llow Mustang’s Marine AI

He puts the model in description

1 Like