How to make ordering pathfinding system?

I am trying to make a pathfinding system to do with “Jobs” as seen in this:

I looked up previous posts on something like this, but it isn’t exactly what I’m looking for. I’m trying to make the NPCs “line up” to order something.

you could probably manipulate the WalkToPoint property of humanoid to get the humanoid to move to the next spot in line. You can find the next spot in line by getting the previous player’s torso and getting a relative cframe to it.

How would I get the previous NPC’s torso? Like for example, I’m just using a Rig in ReplicatedStorage and cloning it, so what would I do then? Unless theres a better way I’m not aware of.

I’d just keep track of how many npc’s you have in each line. Then use some math to find the spot in the line that is X number of spaces from the counter

local targetPos = lineAPosition + Vector3.new(0,0,4*lineACount)

If I wanted to check how many NPCs are in a line, would I use region3 or something?

I would keep track with code. Every time you tell an npc to go to a line, add 1 to a variable. And any time one leaves a line, remove 1 from the same variable.