So I have made a zombie spawner using the zombie model from the toolbox. I made random parts in the workspace where the zombies would spawn. My problem is that the zombie isn’t teleporting to the spawners. Here’s my script:
local folder = script.Parent
enabled = true
local checker = coroutine.create(function()
local counter = 0
while wait() do
counter = 0
for i,v in pairs(workspace.Enemies:GetChildren()) do
if v.Name == "Drooling Zombie" then
counter = counter + 1
end
end
print("Found "..counter.." zombies slippin")
if counter >= 10 then
enabled = false
else
enabled = true
end
end
end)
coroutine.resume(checker)
while wait(2) do
if enabled then
for i,v in pairs(folder:GetChildren()) do
if v:IsA("Part") then
while wait(10) do
if enabled then
local zomb = game:GetService("ReplicatedStorage")["Drooling Zombie"]:Clone()
zomb.Parent = workspace.Enemies
zomb.PrimaryPart.CFrame = v.CFrame
end
end
end
end
end
end
Thats the full script but I believe this is where everything goes wrong:
zomb.PrimaryPart.CFrame = v.CFrame
Also, the rest of the code you see is a limiter I made so that more than 10 zombies cannot spawn.