I want to make a pathfinding but it detects walls so the npc dont get stuck in the wall.
Heres is a little script of the npc pathfinding that i made :
while true do
wait(.1)
local model = workspace:WaitForChild('Grid')--Wait for the child Grid in workspace
local modeltable = model:GetDescendants()
local randompick = modeltable[math.random(#modeltable)--Select random part to move the npc in it.
if tired >= 0 then
if randompick:IsA('BasePart') then
tired = tired -1
script.Parent:MoveTo(randompick.Position)
script.Parent.MoveToFinished:Wait()
wait()
script.Parent.Parent.Script.Script.Disabled = false
end
end
The model that im trying to the npcs dont get stuck is Called "Wall"
Is there any way to make the npc dont get stuck in the walls?

1 comment
use pathfinder service