Spawning an NPC after the other one is destroyed in the same spot the First npc spawned in

I have two npcs that walk to certain points:


this is what it looks like when i run the test:
robloxapp-20221016-1127387.wmv (169.4 KB)

When the npcs stop they get :Destroy() 'ed after 1 second.
Now I want to spawn two more npcs in the same spot, and make them exactly like the old ones. Then loop it so it goes on forever.

oops i posted this in the wrong category

you can :clone the npc when it first spawn then when it got to the destroy spot just give the parent of the npc clone

Do you have the code by any chance? Kinda important! :+1: :]

you could use a recursive function here.

I haven’t tested this, and this is more of a layout of what you should do.

local lastSpawnPosition = nil

local function spawnNPC()
	local clone = NPC_MODEL:Clone() -- replace with their model
	clone.PrimaryPart.CFrame = or, 3, 0) -- put spawn Position here
	lastSpawnPosition = clone.PrimaryPart.Position


I would recommend you use clone:WaitForChild("Humanoid").Died:Once() instead, since the event can only be ran once, after it gets ran it automatically gets disconnected.

I didn’t even think of that, I’ll edit my post.

Everyone there is a new post, please stop posting on this one: Spawning an NPC after the other one is destroyed post your replies on this link, I’m not looking at the ones on here.