I am trying to make an NPC move around and pick up parts around the map using Roblox's pathfinding service. My troubles arise whenever one of the parts is higher elevated than the npc, and when that happens the path doesn't generate at all. I have tried many solutions to fix this and currently nothing has worked. If anyone has some suggestions please tell me, and if you think I should just make my own pathfinding script, then please tell me how I should go about doing it.
while wait() do
local Path = PathfindingService:ComputeRawPathAsync(Part0.Position, Part1.Position, 500)
local Points = Path:GetPointCoordinates()
for i,v in pairs(Points) do
local Part = Instance.new("Part", workspace)
Part.Anchored = true
Part.Position = v
Part.Transparency = 0
Part.Size = Vector3.new(.5,.5,.5)
Part.Color = Color3.fromRGB(255,0,0)
game.Debris:AddItem(Part, .1)
end
end

7 comments
Well you should be posting the full code or else we can't help. I understand you want help but you should help us too.
You shouldn't need the code. It's just the simple pathfinding service code but I will show you what it's based on anyways
This isn't the code currently inside the NPC btw, this is just the method I used to make the path
What do you mean by higher elevated than the npc? Pathfinding only works if it has a way to get there, so you can't expect it to just Superman fly up to wherever and get an item
ComputeRawPathAsync is deprecated, new documentation is here https://www.robloxdev.com/api-reference/class/PathfindingService
tyler is right. npcs cannot fly.
the problem wasn't with them flying but wrather it didn't notice that I had a jump function set up with the npc so if it was not accessible via stairs, It would completely ignore the part completely