Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is there a way to a npc Detect is theres a wall in front of him?

Asked by 4 years ago

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?

0
use pathfinder service TheRealPotatoChips 793 — 4y

Answer this question