How to make pathfinding avoid specific moving parts

Is there any way to make a pathfinding npc to avoid specific parts?
I’m trying to make a game where you fight npcs and you can use attack on them(you click somewhere and it spawns an attack), and I can’t find a way for the npc to dodge/avoid the attack, can somebody give me an idea so I can try and make it in a script?

2 Likes

I don’t think using pathfinding for this is a smart idea. Instead you should just have the NPC react to the fact that you have initiated an attack.

1 Like

You could do it maybe so that it fires a raycast and if it hit the attack or detect the attack some otherway then when the attack is about to be done spawn in an invisble but collideable wall reload the path so the npc moves around the wall making it look like it’s dodging it?

1 Like

I’ll try something like this, but instead of raycasting I think it would be better to detect when an attack is made from the workspace, wait until the magnitude is close to it and then make a part behind it that the npc needs to go to, I’ll tell you if it worked!