NPC moving one at a time

Currently I have this script and module script which manages NPC path finding. The problem is, looping through the guards, it calls the module script function one at a time. So that the next NPC wont start moving until the previous NPC has finished moving.
https://gyazo.com/8f224208e74c886245d3733b59f5639c

I want them to move simultaneously, how would I go about doing this?

Server Script

local Patrol_Delay = 2
while wait(Patrol_Delay) do
	for _,Guards in pairs(workspace["Lvl"..CurrentLevel].NPC.Guard:GetChildren()) do	-- Loop through all NPC in guards folder
		local Path = PathfindingService:CreatePath()
		NPC_AI.Activate2WayPoints(Guards.Name, Path, Patrol_Delay)	-- Call module script function
	end
end

Module Script

function NPC_AIPathfinding.Activate2WayPoints(key, Path, Patrol_Delay)	-- Moving between two points
	local NewKey = key:split("_")	-- Split the guards name to find what folder its located in
	local NPCFolder = workspace[NewKey[1]..""].NPC
	
	local StartPosition = NPCFolder.Waypoints[NewKey[2].."_A"].Position	-- Create start and end
	local EndPosition = NPCFolder.Waypoints[NewKey[2].."_B"].Position
	Path:ComputeAsync(StartPosition, EndPosition)

	local waypoints = Path:GetWaypoints()
	for _, waypoint in pairs(waypoints) do	-- Loop through waypoints
		NPCFolder.Guard[key..""].Humanoid:MoveTo(waypoint.Position)
		NPCFolder.Guard[key..""].Humanoid.MoveToFinished:Wait()
	end

	wait(Patrol_Delay)  -- Pause for 2 seconds when point B is reached

	for TableIndex = #waypoints, 1, -1 do	-- Return through waypoints
		NPCFolder.Guard[key..""].Humanoid:MoveTo(waypoints[TableIndex].Position)
		NPCFolder.Guard[key..""].Humanoid.MoveToFinished:Wait()
	end
end

wrap the whole function in a coroutine

I think you want coroutines, it would probably looks something like this:

local Patrol_Delay = 2
while wait(Patrol_Delay) do
	for _,Guards in pairs(workspace["Lvl"..CurrentLevel].NPC.Guard:GetChildren()) do	-- Loop through all NPC in guards folder
        local guardThread = coroutine.wrap(function()
		    local Path = PathfindingService:CreatePath()
		    NPC_AI.Activate2WayPoints(Guards.Name, Path, Patrol_Delay)	-- Call module script function
        end)
        guardThread()
	end
end

I had thought of doing that as well, the only problem is that it seems the patrol_delay wait time gets completely disregarded and the NPC doesn’t reach the final waypoint before turning back again.
https://gyazo.com/11e40e2fb0c484d2adf625f21e3bd46d

put a debounce in your npc function that prevents it from being called unless the guard is done moving, an example would be

local npcs = {["Lvl1_Guard2"] = true} -- Table of every npc name
function a(name,path,delay) 
 if npcs[name] == true then
  npcs[name] = false
  -- do stuff
 npcs[name] = true
 end
end

Right, I suppose your post is the right answer, however I modified it so the debounce was in the coroutine in the server script since it wouldn’t work in the module script.