Cloning Script Not Working

So Iā€™m making a little game, and I tried to make a script where zombies are cloned every so often.

local ServerS = game:GetService("ServerStorage")
local zombieServer = ServerS.Zombie

while true do
	zombieServer:Clone()
	zombieServer.Parent = game.Workspace
	wait(2)
end

However, only one zombie is spawned. Any solutions?
Thanks for everything :wink:

You need to define a new variable for the clone.

local ServerS = game:GetService("ServerStorage")
local zombieServer = ServerS.Zombie

while true do
	local clone = zombieServer:Clone()
	clone.Parent = game.Workspace

	task.wait(2) -- use task.wait() instead of wait()
end
2 Likes

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