so the variable named “newFolder” isnt being destroyed. plz helpzz
local round = {}
round.__index = round
round.Maps = game.Workspace:WaitForChild("Maps"):GetChildren()
round.Players = game.Teams:WaitForChild("Survivors")
round.Status = "Intermission"
round.GUIPusher = game.ReplicatedStorage:WaitForChild("fireClient")
round.CurrentMap = nil
round.nightTime = 8e5
round.Waves = game.ReplicatedStorage.Waves:GetChildren()
round.nights = 0
round.ZombiesFolder = game.Workspace:WaitForChild("Zombies")
local runService = game:GetService("RunService")
function round:Intermission()
local currentStatus = self.Status
currentStatus = "Intermission"
self.GUIPusher:FireAllClients(currentStatus, "Voting")
task.wait(5)
end
function round:Start()
local currentStatus = self.Status
currentStatus = "CommenceMent"
self.GUIPusher:FireAllClients(currentStatus, "Progress")
self.nights += 1
local newWave = self.Waves[self.nights]:Clone()
newWave.Parent = self.ZombiesFolder
if #newWave:GetChildren()==0 then
newWave:Destroy()
end
game.ReplicatedStorage.registerVotes.OnServerEvent:Connect(function(plr, msg)
self.CurrentMap = table.find(self.Maps, msg)
return self.CurrentMap
end)
local chosenMap = self.CurrentMap
for _, player in ipairs(self.Players:GetPlayers()) do
if player:IsA("Player") and runService:IsServer() then
local char = player.Character or player.CharacterAdded:Wait()
local humRP = char:WaitForChild("HumanoidRootPart")
humRP.CFrame = chosenMap.CFrame
end
end
task.wait(self.nightTime)
end
function round:End()
if not round:Start() then
local currentStatus = self.Status
currentStatus = "Ended"
self.GUIPusher:FireAllClients(currentStatus, "Ended")
task.wait(5)
end
end
return round