Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you fix it?, the Zombies do not get destroyed. Did I make any mistakes?

Asked by
Ifesol 4
2 years ago
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)
1
line 6 use for i, v in ipairs(zombies) do end MarkedTomato 810 — 2y
0
You provided very little information. I don't know what (game.Workspace.Spawns.Script) is. Is it the script you're currently writing in? MarkedTomato 810 — 2y
0
try what markedtomato said and then do v:Destroy() pwnd64 106 — 2y
0
It is the folder where the spawn part are for the zombies Ifesol 4 — 2y
View all comments (2 more)
0
you can try using :ClearAllChildren, when only the zombies are in the model/folder PokeCrafterC 7 — 2y
0
It worked, thank you. @PokeCrafterC Ifesol 4 — 2y

2 answers

Log in to vote
0
Answered by 2 years ago
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)
Ad
Log in to vote
0
Answered by
Ifesol 4
2 years ago
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

Answer this question