So I have been making pacman and I created a script that make the ghosts track pacman, and It was working and I had finished the game and left. When I got back roblox had gone down but nothing had been lost when I got back on, But the ghosts stop moving. I Tried a bunch of things that lead me to printing the path.status, and it outputed Enum.PathStatus.NoPath. I will like if anyone could help
here is my code
local pathfinding = game:GetService(“PathfindingService”)
local ghost = script.Parent
local zombie = ghost.zombie
local flee = game.Workspace.PacMan[“flee nodes”]
while true do
wait(0.01)
if script.Parent.alive.Value == true then
print(“alive”)
if game.Workspace.PacMan.playing.Value == true then
print(“playing”)
if game.Workspace.PacMan.caneat.Value == false then
print(“not eating”)
zombie.WalkSpeed = 35
local thing = game.Workspace.PacMan.player.PrimaryPart
print(“found end part”)
local path = pathfinding:CreatePath()
print(“path made”)
path:ComputeAsync(ghost.HumanoidRootPart.Position, thing.Position)
print(“path caculated”)
print(path.Status)
if path.Status == Enum.PathStatus.Success then
print(“path success”)
local nodes = path:GetWaypoints()
print(“got waypoints”)
for i,v in pairs(nodes) do
print(“moveing”)
zombie:MoveTo(v.Position)
zombie.MoveToFinished:Wait(1)
end
end
elseif game.Workspace.PacMan.caneat.Value == true then
zombie.WalkSpeed = 50
local num = math.random(1,12)
if num == 1 then
local path = pathfinding:CreatePath()
path:ComputeAsync(ghost.HumanoidRootPart.Position, flee.node1.Position)
if path.Status == Enum.PathStatus.Success then
local nodes = path:GetWaypoints()
for i,v in pairs(nodes) do
zombie:MoveTo(v.Position)
zombie.MoveToFinished:Wait(1)
end
end
elseif num == 2 then
local path = pathfinding:CreatePath()
path:ComputeAsync(ghost.HumanoidRootPart.Position, flee.node2.Position)
if path.Status == Enum.PathStatus.Success then
local nodes = path:GetWaypoints()
for i,v in pairs(nodes) do
zombie:MoveTo(v.Position)
zombie.MoveToFinished:Wait(1)
end
end
elseif num == 3 then
local path = pathfinding:CreatePath()
path:ComputeAsync(ghost.HumanoidRootPart.Position, flee.node3.Position)
if path.Status == Enum.PathStatus.Success then
local nodes = path:GetWaypoints()
for i,v in pairs(nodes) do
zombie:MoveTo(v.Position)
zombie.MoveToFinished:Wait(1)
end
end
elseif num == 4 then
local path = pathfinding:CreatePath()
path:ComputeAsync(ghost.HumanoidRootPart.Position, flee.node4.Position)
if path.Status == Enum.PathStatus.Success then
local nodes = path:GetWaypoints()
for i,v in pairs(nodes) do
zombie:MoveTo(v.Position)
zombie.MoveToFinished:Wait(1)
end
end
elseif num == 5 then
local path = pathfinding:CreatePath()
path:ComputeAsync(ghost.HumanoidRootPart.Position, flee.node5.Position)
if path.Status == Enum.PathStatus.Success then
local nodes = path:GetWaypoints()
for i,v in pairs(nodes) do
zombie:MoveTo(v.Position)
zombie.MoveToFinished:Wait(1)
end
end
elseif num == 6 then
local path = pathfinding:CreatePath()
path:ComputeAsync(ghost.HumanoidRootPart.Position, flee.node6.Position)
if path.Status == Enum.PathStatus.Success then
local nodes = path:GetWaypoints()
for i,v in pairs(nodes) do
zombie:MoveTo(v.Position)
zombie.MoveToFinished:Wait(1)
end
end
elseif num == 7 then
local path = pathfinding:CreatePath()
path:ComputeAsync(ghost.HumanoidRootPart.Position, flee.node7.Position)
if path.Status == Enum.PathStatus.Success then
local nodes = path:GetWaypoints()
for i,v in pairs(nodes) do
zombie:MoveTo(v.Position)
zombie.MoveToFinished:Wait(1)
end
end
elseif num == 8 then
local path = pathfinding:CreatePath()
path:ComputeAsync(ghost.HumanoidRootPart.Position, flee.node8.Position)
if path.Status == Enum.PathStatus.Success then
local nodes = path:GetWaypoints()
for i,v in pairs(nodes) do
zombie:MoveTo(v.Position)
zombie.MoveToFinished:Wait(1)
end
end
elseif num == 9 then
local path = pathfinding:CreatePath()
path:ComputeAsync(ghost.HumanoidRootPart.Position, flee.node9.Position)
if path.Status == Enum.PathStatus.Success then
local nodes = path:GetWaypoints()
for i,v in pairs(nodes) do
zombie:MoveTo(v.Position)
zombie.MoveToFinished:Wait(1)
end
end
elseif num == 10 then
local path = pathfinding:CreatePath()
path:ComputeAsync(ghost.HumanoidRootPart.Position, flee.node10.Position)
if path.Status == Enum.PathStatus.Success then
local nodes = path:GetWaypoints()
for i,v in pairs(nodes) do
zombie:MoveTo(v.Position)
zombie.MoveToFinished:Wait(1)
end
end
elseif num == 11 then
local path = pathfinding:CreatePath()
path:ComputeAsync(ghost.HumanoidRootPart.Position, flee.node11.Position)
if path.Status == Enum.PathStatus.Success then
local nodes = path:GetWaypoints()
for i,v in pairs(nodes) do
zombie:MoveTo(v.Position)
zombie.MoveToFinished:Wait(1)
end
end
elseif num == 12 then
local path = pathfinding:CreatePath()
path:ComputeAsync(ghost.HumanoidRootPart.Position, flee.node12.Position)
if path.Status == Enum.PathStatus.Success then
local nodes = path:GetWaypoints()
for i,v in pairs(nodes) do
zombie:MoveTo(v.Position)
zombie.MoveToFinished:Wait(1)
end
end
end
end
end
end