local rep = game.ReplicatedStorage
local zombies = game.Workspace.Zombies:GetChildren()
rep.Died.OnServerEvent:Connect(function(player)
for i = 1, #zombies do
zombies[i]:Destroy()
game.Workspace.Spawns.Script.Disabled = true
end
end)
rep.resurrect.OnServerEvent:Connect(function(player)
game.Workspace.Spawns.Script.Disabled = false
end)
COMMUNITY QUESTION
How do you fix it?, the Zombies do not get destroyed. Did I make any mistakes?
2 answers
local rep = game.ReplicatedStorage
local zombies = game.Workspace.Zombies:GetChildren()
rep.Died.OnServerEvent:Connect(function(player)
for _, zombiezz in pairs(zombies) do
zombiezz:Destroy()
end
game.Workspace.Spawns.Script.Disabled = true
end)
rep.resurrect.OnServerEvent:Connect(function(player)
game.Workspace.Spawns.Script.Disabled = false
end)
local rep = game.ReplicatedStorage
local zombies = game.Workspace.Zombies
rep.Died.OnServerEvent:Connect(function(player)
zombies:ClearAllChildren()
game.Workspace.Spawns.Script.Disabled = true
end)
rep.resurrect.OnServerEvent:Connect(function(player)
game.Workspace.Spawns.Script.Disabled = false
end)
This works, thank you all for your help
This discussion is preserved as it was. New answers, comments, and votes are closed.

6 comments
line 6 use for i, v in ipairs(zombies) do end
You provided very little information. I don't know what (game.Workspace.Spawns.Script) is. Is it the script you're currently writing in?
try what markedtomato said and then do v:Destroy()
It is the folder where the spawn part are for the zombies
you can try using :ClearAllChildren, when only the zombies are in the model/folder
It worked, thank you. @PokeCrafterC