Cloning items several times

Hey there,

I have a game and want to clone a zombie model a certain amount of times
However, the model only clones 2 times, here is my main module:

function f()
	game.ServerStorage.Zombie:Clone().Parent = workspace
end

function spawnZombies()
	deleteZombies()
	local zombieModel = game.ServerStorage.Zombie
	if _G.zombie == nil or 0 then
		for i = 0,1 do
			zombieModel:Clone().Parent = workspace
		end
		wave += 1
	else
		local count = 0
		repeat wait()
			count += 1
			f()
		until count == wave
		wave +=1
	end
	print(wave)
	
	while wait(2) do
		for i,v in pairs(workspace:GetChildren()) do
			if workspace:FindFirstChild("Zombie") then
				continue
			else
				spawnZombies()
				break
			end
		end
	end
end

For 0, 1 means zombieModel:Clone().Parent = workspace will run 2 times, from 0 (first counter) to 1 (second counter) which will count as 2, increase for i = 0,1 do if you want it to clone more than 2 times, for example: if you make it for i = 0,2 do it’ll clone it 3 times. (0 > 1 > 2), runs 3 times, starting from 1 is better so it’s easier to understand.

1 Like

I usually do “1, 2” so you know how much it repeats without needing to add 1

1 Like