Zombie Spawner Doesnt Work

Hi.This script is not working and basically i want it to spawn zombies at different spots i chose but theres a problem please help?

1 Like

The for loop is not a for loop because the underscore is overriding it. You need a space after the for. You would want for _

There’s a lot of errors in the code.

local spawns = script.Parent
local spawn_time = 10
while true do
    for _, spwn in pairs(spawns:GetChildren()) do
        if spwn:IsA("BasePart") then
            local zombieCopy = game.ReplicatedStorage["Zombie"]:Clone()
            zombieCopy.Parent = workspace
            zombieCopy.HumanoidRootPart.CFrame = CFrame.new(spwn.Position + Vector3.new(0,3,0))

This code should work if nothing else errors.
One problem was that you didn’t put a space right after for, so it wouldn’t work. Another problem was that you wrote spwn:IsA =("BasePart") then. Not all conditionals need an equals sign.

1 Like

Ok Thank you ill try the and fix the code

Thank you very much For giving me the solution