Hello, I'm trying to make my NPC chase after another NPC only if they are on a different team. But I have no idea how to make an NPC chase after an NPC.
For example here how the code should be formatted;
if find another NPC on team blue then chase after them and attack else attack blue team main base.
This is how the script somehow should look like.
But here's the problem;
i don't know how to script the :if find another NPC on team blue then" part and also I don't know how to make NPC's chase after them.
I do know how to make them attack and once I know how to make NPC chase after something I will know how to do the last line as well.
So in the end;
what i'm looking for is
How to find nearest NPC on blue team (StringValue) Forexample; Team: Blue
How to make NPC chase after the enemy.
You could create two folders in workspace, one called Blue, one called Red and in each npc loop through the other folder and find the closest one to it, to attack it using .magnitude and then use pathfinding to chase it. magnitude, PathFinding , or instead of using folder, set their team and do the rest
local magnitude = (part1.Position - part2.Position).magnitude print(magnitude) if magnitude < 50 then --code end