As the title suggests, when I run my pathfinding script, it is not creating waypoints. I have used path.Status to check and everytime I run it I get the same issue ‘Enum.PathStatus.NoPath’.
Here’s my code (local script):
local Players = game:GetService("Players")
local PathfindingService = game:GetService("PathfindingService")
local Self = Players.LocalPlayer
local mouse = Self:GetMouse()
mouse.Button1Down:Connect(function()
local human = Self.Character.Humanoid
local path = PathfindingService:CreatePath()
path:ComputeAsync(Self.Character.PrimaryPart.Position, game.Workspace.EndPart.Position)
local waypoints = path:GetWaypoints()
print(#waypoints)
if path.Status == Enum.PathStatus.Success then
for i, wp in pairs(waypoints) do
print(wp, wp.Position)
human:MoveTo(wp.Position)
human.MoveToFinished:Wait(2)
end
else
print('something happened' .. tostring(path.Status))
end
end)