How would I space out a group of NPCs

I have a group of armored vehicles that use pathfinding to navigate to various targets around the map, however when traveling in multiples the vehicles overlap each other and clump together once they reach their destination. This makes it hard to distinguish between vehicles and make out what is happening in battle.

I would like for them to follow the target but keep a bit of distance from one another, similar to how Army Tycoon does it.

How it looks:

How I want it to look:

Pathfinding Script:

local function FollowPath(pos)
	local success, errorMsg = pcall(function()
		path:ComputeAsync(npc.PrimaryPart.Position, pos)
	end)	
	if success and path.Status == Enum.PathStatus.Success then
		waypoints = path:GetWaypoints()
		
		blockedBind = path.Blocked:Connect(function(blockedWaypoint)
			if blockedWaypoint >= nextWaypoint then
				blockedBind:Disconnect()
				
				if target then
					FollowPath(target.PrimaryPart.Position)
				end
			end
		end)
		
		if not reachedBind then
			reachedBind = humanoid.MoveToFinished:Connect(function(reached)
				if reached and nextWaypoint < #waypoints then
					nextWaypoint += 1
					humanoid:MoveTo(waypoints[nextWaypoint].Position)
				else
					reachedBind:Disconnect()
					blockedBind:Disconnect()
				end
			end)
		end
		
		nextWaypoint = 2
		humanoid:MoveTo(waypoints[nextWaypoint].Position)
	end
end

Any ideas on how to approach this?

2 Likes

maybe make the tanks solid [spoiler]turning on canCollide[/spoiler]

maybe use a loop?

It looks a little jank with collisions on and it would probably look worse with even more units