PathfindingService is not creating any Waypoints and returning no path

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)

Make sure no scripts are interfering with this script. I copy and pasted your code into Studio and ran it myself. It doesn’t look like your code has any issues as it ran perfectly for me.

1 Like