I need some help on pathfinding, idk why it won’t go forward. It’s supposed to go to towards the brick but nothing happens.
local PathfindingService = game:GetService("PathfindingService")
local Path = PathfindingService:CreatePath()
local rs = game:GetService("ReplicatedStorage")
Path:ComputeAsync(script.Parent.HumanoidRootPart.Position, workspace.h.Position)
local Waypoints = Path:GetWaypoints()
for i, waypoint in pairs(Waypoints) do
script.Parent.Humanoid:MoveTo(waypoint.Position)
script.Parent.Humanoid.MoveToFinished:Connect(function()
print("Done")
end)
end
Try removing the local Waypoints = Path:GetWaypoints() and change the for i, waypoint in pairs(Waypoints) do into for i, waypoint in pairs(Path:GetWaypoints()) do and add script.Parent.Humanoid.MoveToFinished:Wait() above script.Parent.Humanoid.MoveToFinished:Connect(function()