Hi Roblox Community,
So I’m trying to make a NPC who walks randomly between paths, this is working fine, but when something is between this path, the NPC just walks in it and stops. This im my script:
wait()
local NpcHumanoid = script.Parent
local WayPoints = workspace.WayPoints:GetChildren()
local PathService = game:GetService("PathfindingService")
function patrol()
local randomwaypoint = math.random(1, #WayPoints)
local chosenwaypoint = WayPoints[randomwaypoint]
NpcHumanoid:MoveTo(chosenwaypoint.Position)
NpcHumanoid.MoveToFinished:Wait()
end
while (true) do
wait()
patrol()
end
I hope someone can help me
~ Maini