NPCs bunching up

I have a moving system but for some reason after the 1st NPC, all npcs just crowd into the same spot. Why is this?
script that controls where they move

function Customer:Enter(CF)
	local PrimaryCustomer = Customer.Active[1]==self
	if PrimaryCustomer then
		moveTo(self,CF)
	else
		local ActiveCustomers = #Customer.Active
		print(ActiveCustomers)
		moveTo(self,CF*CFrame.new(0,0,ActiveCustomers+3))
		repeat task.wait() 
			if #Customer.Active <= ActiveCustomers then
				moveTo(self,CF*CFrame.new(0,0,#Customer.Active+3))
				ActiveCustomers = #Customer.Active
			end
		until Customer.Active[1]==self
		task.wait(.5)
		moveTo(self, CF)
	end
end

1 Like

Question Solved
Incorrect Checks

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.