Unable to clone the same NPC twice into workspace

Hello developers,

I’m trying to make a Papers please alike job, where you sit in a booth, then it’d spawn an NPC that goes to a queue line then moves to your booth, it’s all working until an issue popped up.

The queue line would contain multiple NPC’s waiting, but I cannot spawn the same NPC and put it in studio more than once, if I try to for example put 2 of the same NPC’s using Clone():

  • The first NPC is spawned and goes to its line
  • The second NPC spawns but the first dissapears/gets deleted once the 2nd spawns in

This is how it looks like: NPC Issue

local NPCModel = game:GetService("ReplicatedStorage"):WaitForChild("Models"):WaitForChild("NPC")
local NPCQueue = workspace:WaitForChild("BorderNPCLinePoint"):WaitForChild("NPCQueue")
local lineUp = workspace:WaitForChild("BorderNPCLinePoint")

function NPC_Service:SpawnNPC()
	local NewNPC = NPCModel:Clone()
	NPCModel:SetPrimaryPartCFrame(workspace:WaitForChild("BorderNPCSpawnPoint").Part.CFrame * CFrame.new(0,1,0))
	NPCModel.Name = "NPC|"..tostring(#workspace:WaitForChild("BorderNPCLinePoint"):WaitForChild("NPCQueue"):GetChildren() + 1)
	NPCModel.Parent = workspace
	
	NPCModel.Humanoid:MoveTo(lineUp:FindFirstChild("linePart|"..tostring(#NPCQueue:GetChildren() + 1)).Position)
	
	return NewNPC
end

Can I not spawn the same NPC twice or am I doing something wrong?
Thanks in advance.

inside the function your using the wrong variable
use the “NewNPC” instead of “NPCmodel”
lines 7 - 11

Alright, thanks for the note, I thought I was unable to clone the same NPC twice.