Help With Pathfinding Script

So I had this script:

local pathFindingService = game:GetService("PathfindingService")
local human = script.Parent:WaitForChild("Humanoid")
local HumanoidRootPart = script.Parent:WaitForChild("HumanoidRootPart")
local endPoints = script.Parent.Parent.Parent:WaitForChild("NPCEnd"):GetChildren()

while true do 
	local xpos = math.random(0.5, 5)
	local zpos = math.random(0.5, 5)
	local randomEndPoint = endPoints[math.random(1, #endPoints)]
	local randPos = randomEndPoint.Position + Vector3.new(xpos, 0, zpos)

	local path = pathFindingService:CreatePath()
	path:ComputeAsync(HumanoidRootPart.Position, randPos)
	local waypoitns = path:GetWaypoints()
	print(waypoitns)

	for i, waypoint in pairs(waypoitns) do
		human:MoveTo(waypoint.Position)
		human.MoveToFinished:Wait(2)
	end
	wait(math.random(1, 5))
end

and it worked perfectly fine yesterday, but today it does not work at all!

Does anyone have any idea what is wrong, or is there just a problem with pathfinding service right now?

do you have any video of it glitching?

also grammar

1 Like

lol. It doesn’t glitch, but when i run the code nothing happens. the npc just sits there. When it prints the waypoints, it prints a blank table.

Any errors in the output? Also what type of script is it and where is it located

The script does not error.
I have it disabled as a child of another script. They are all in a folder with the npcs. The first script makes a copy of that one, and then puts it into each npc, and makes the script enabled. It is also a server script.

Well I have not changed a single thing and the script now runs perfectly. Maybe Pathfinding service was down?