PathFindingService Not Giving Warning!

Alrighty! I want to keep this post short and simple so I will try to keep it pretty basic. So I am trying to make a homing missal that will guide itself around obstacles and hit it’s target. Only 2 minutes into the creation, I ran into an issue which was with the PathFindingService. I didn’t get any errors nor warnings of any type and it still wouldn’t work.

Basically the missal is just an anchored part in the workspace and the endpart is just a part behind several walls.

I was using tweens to move from part to part and it would not work.

I decided to trouble shoot and came up with this script. It still printed 0.

local service = game:GetService("PathfindingService")
local tweenservice = game:GetService("TweenService") wait(1.45)

local path = game:GetService("PathfindingService"):CreatePath()
path:ComputeAsync(game.Workspace.missle.Position, game.Workspace.eee.Position)
local getpoints = path:GetWaypoints()

local number = 0

for i,points in pairs(getpoints) do
	number += 1
end

print(number)

Any help is apreciated!
Thanks a lot!

1 Like

Pathfinding right now is really only good for computing paths that a regular sized Roblox character can follow, not other smaller or larger entities. You should check the navigation mesh and see if the path you were expecting but did not get is valid for the entity you’re pathfinding for.

Additionally, you have no reason to be getting any warnings. The calls you made were successful but if you aren’t getting any paths then it’s not able to compute a path between the points you specified. You should not be assuming that you’d get a warning or that the number of points will be non-zero after a computation, change your debugging steps. The first thing you should be checking is the path’s status. You can then also check CheckOcclusionAsync and Blocked.

The PathStatus, results of CheckOcclusionAsync and fires on the Blocked event will help provide context for your thread if you’re looking for additional help, provided you can’t use the PathStatus and navmesh as a guideline to resolve the issue yourself. If it comes to that, please do also provide additional context such as media of the current setup you’re working with.

The missal is not an entity in any way shape or form. It is simply just a part. I understand that the missal may run into objects since it is good for regular sized entities but none the less, based off the code there is no reference to the fact that it is an entity to make it run in the first place, therefor it wouldn’t matter. Also, the calculation should run perfectly since this is the setup:

https://gyazo.com/ec07e2988010648cff3efb21f33bace7

The slimmer more stick like part is the projectile.

Alright I fixed it, I lowered both of the parts down and it made the calculation. It seems as if the service doesn’t account for the Y-axis. I see what you are saying now.

Didn’t want to be particularly pedantic here but by entity I’m referring to its literal definition as in an existing object in your workspace, or “Instance” as it’s called by the API. Anything can be an entity if it “has a distinct and independent existence”, which your missile is. Hopefully that clears up confusion in case you thought by entity I was referring to your missile as a character and not a part.

Right, that changes things. Thank you.

Alright, so I do have a concern however. If the parts are above humanly possible altitudes, why is the calculation just failing and not running properly. Because when I did get it working the waypoints were just dragging the part across the ground.

  • I am relatively new to the service to be quite honest with you.

https://gyazo.com/1fadc8aa34e0b923dd7de1be29f82ff8

Points are computed along the navigation mesh, not arbitrary spaces. If you want aerial pathfinding you’re either going to have to proxy it with a part which would make it a valid navmesh target or implement custom pathfinding and figure out your own node generation for it.

What about navmesh? What is that?

Or sorry, proxying with a part, what does that mean?

It’s in the documentation.