Some times - Pathfinding error 'Function Path.GetWaypoints is not safe to call in parallel'

Hello,

I have a pathfinding script that was working fine, and now when I was playing with the NPC it did good but when I jumped over it a few times it spit out an error and stopped moving.

I have already searched for info here, and googled it… found nothing…

Any thoughts ? thanks !

22:43:05.008 Function Path.GetWaypoints is not safe to call in parallel - Server - npc-grab:50
22:43:05.009 Stack Begin - Studio
22:43:05.009 Script ‘Workspace.LB.npc-grab’, Line 50 - function findPath - Studio - npc-grab:50
22:43:05.009 Script ‘Workspace.LB.npc-grab’, Line 175 - function main - Studio - npc-grab:175
22:43:05.009 Script ‘Workspace.LB.npc-grab’, Line 186 - Studio - npc-grab:186

function findPath(target)
local path = game:GetService(“PathfindingService”):CreatePath()
path:ComputeAsync(myRoot.Position,target.Position)
local waypoints = path:GetWaypoints() – line 50

–more code blah blah

function main()
local target = findTarget()
if target then
myHuman.WalkSpeed = 16
findPath(target) – line 175
else
myHuman.WalkSpeed = 8
walkRandomly()
end
end

while wait(0.1) do
if myHuman.Health < 1 then
break
end
main() – line 186
end

I don’t think this is the full script? The error means that you are calling GetWaypoints while in parallel. Did you use task.desychronise?