Hey! A part of my script wont move a character to a specific point in the map and I’m not sure why.
Only thing I know is that it doesn’t create any waypoints; The waypoints table is empty. Please help.
local h,t = char.Humanoid,char.Torso
local p = pFS:CreatePath{WaypointSpacing = 2,AgentCanJump = true,AgentHeight = 5,AgentRadius = 3}
p:ComputeAsync(t.Position,Vector3.new(-28, 970, -27))
local w = p:GetWaypoints()
for i, way in pairs(w) do
local wT = 0
if way.Action == Enum.PathWaypointAction.Jump then
h:ChangeState(Enum.HumanoidStateType.Jumping)
end
h:MoveTo(way.Position)
repeat wT+=1 task.wait() until (t.Position - way.Position).magnitude < 4 or wT > 250
end
Replace your Vector3 with a part at the exact position you want the NPC to move to and use that in the script. See if the behaviour changes.
The reason I say this is that Vector3 is very high at 970 studs.
It’s hard to tell from the image you posted - Are you using Terrain in your game? This sometimes causes the navigation mesh to not align properly if there is a piece of terrain floating around that you thought was deleted etc.
Go to Studio Settings and turn on ‘Show Navigation Mesh’ in Visualization section. This will overlay your map with a mesh showing the area PathFinding uses. It should be level with your floors etc but can sometimes generate in unexpected areas (especially if there is terrain around - in my case it was thousands of studs below the actual map)
I’m also getting empty waypoint arrays. I’ve checked the nav mesh, checked the path status (NoPath), and I doubt it has to do with actually moving humanoids, because it won’t move without an array of waypoints. The code I used for so long is only just now starting to act up, and it’s totally beyond me on as to why.
I tried fiddling with the agentparams, looked at the wiki, and still came up empty handed. Has Roblox done anything to pathfinding recently that would correlate to this issue?