i was doing a monster that uses pathfinding but it wont move and every path even the simple path like go from 0,0,0 to 5,0,0 wont work
Code
local Humanoid = script.Parent:WaitForChild("Humanoid")
local Root = script.Parent:WaitForChild("HumanoidRootPart")
local Roaming = true
local Finished = true
-- unused
local Parm = {AgentHeight = 6;AgentRadius = 3;AgentCanJump = false;Cost = {Water = 100;DangerZone = math.huge}}
function Roam()
Finished = false
local Path = game:GetService("PathfindingService"):CreatePath()
local A = Vector3.new(math.random(-256,256),math.round(Root.Position.Y),math.random(-256,256))
print(A)
Path:ComputeAsync(Root.Position, A)
local Waypoints = Path:GetWaypoints()
print(Path.Status,Waypoints)
if Path.Status == Enum.PathStatus.Success then
for _,Waypoint in pairs(Waypoints) do
if Waypoint.Action == Enum.PathWaypointAction.Jump then
Humanoid.Jump = true
end
Humanoid:MoveTo(Waypoint.Position)
Humanoid.MoveToFinished:Wait()
end
wait(1.2)
Finished = true
else
Finished = true
end
end
while wait(10) do
print(Roaming,Finished)
if Roaming and Finished then
print("Roam")
Roam()
end
end
Output
Enum.PathStatus.NoPath {}