so im making a path finding script for my boss, and it worked for a bit (btw back then i made a post about this too cuz it had an error). then i decided to mess around a bit and no errors, but path finding wont work?
idk wat the problem is but im sure its fairly new and only errored when i messed around with the script…
local path = PathFindingService:CreatePath(pathParams)
if NearestTarget then
path:ComputeAsync(newBossModel.HumanoidRootPart.Position, NearestTarget.HumanoidRootPart.Position)
end
if AttackTarget then
remote2:Fire() --ignore its just an attack remote..
local Waypoints = path:GetWaypoints()
for i, waypoint in pairs(Waypoints) do
humanoid:MoveTo(waypoint.Position)
humanoid.MoveToFinished:Wait(2)
end
else --just incase the player is not in the attack range..
local Waypoints = path:GetWaypoints()
for i, waypoint in pairs(Waypoints) do
humanoid:MoveTo(waypoint.Position)
humanoid.MoveToFinished:Wait(2)
end
end
I fixed the problem, i had an if statement that was impossible to be true, so i deleted it and it works now!! I decided to check my whole entire script after @Fusionet told me to print the path’s status and it didnt print, printed nearesttarget and it was nil, decided to check where the nearesttarget was returned and before it returned it had the if statement (it was impossible to be true since it checks if the player is in the arena but i removed it)