Best way to go about making an AI patrol a maze in a grid pattern

I’ve been trying to make a horror game, and I’ve been trying to get my AI to patrol the maze in a grid pattern. However after trying to use roblox pathfindingservice I’ve come across a lot of issues where the AI gets stuck on walls sometimes and stutters, but most importantly I’m not sure how to get it to walk following a grid pattern around the maze.

If there is any way I could make my AI walk in a grid pattern via pathfindingservice or some other method please let me know. Thanks!

2 Likes

Stuttering is probably caused by network ownership flipping between Player and Server. This should be set to nil, so

-- This assumes the NPC control script is a child under the NPC character
script.Parent:SetNetworkOwner(nil) 

For the pathfinding it is a case of making sure your AgentRadius is set to allow the NPC to not hit walls, but to still be able to navigate between narrow spaces. Experiment with values tp see what works.

1 Like