Why are zombies not spawning again after i kill them, i originally used the Destroy(), but it still did not work

they need to respawn a second time, please help

After the first night, they do not respawn after the second night

	local LightingService = game:GetService("Lighting")
	local TIME_DAY = 6 -- hour of night
	local TIME_NIGHT = 18 -- hour of spawn 
	local zombiesActive = false -- This is our debounce
	
---------------------------------------------------------------------------------

	local ZombieT1Copy = game.ServerStorage.T1_Group1:Clone()   --PART TO CLONE

	local ZombieT1Group2Copy = game.ServerStorage.T1_Group2:Clone()

		local ZombieT1Group3Copy = game.ServerStorage.T1_Group3:Clone()
		
			local Zombie_001 = game.ServerStorage.T1_Group1
				local ZombieFolder1 = game.Workspace.WorkspaceEnemys.T1_Midnight_G1
	 			local ZombieFolder2 = game.Workspace.WorkspaceEnemys.T1_Midnight_G2
				local ZombieFolder3 = game.Workspace.WorkspaceEnemys.T1_Midnight_G3
-------------------------------------------------------------------------------------------------

	local function ClockTimeChanged()
	    local newClockTime = LightingService.ClockTime
	 
		    if zombiesActive then
		        -- If zombies are out check if the ClockTime is day.
		 
		        if (newClockTime >= TIME_DAY and newClockTime < TIME_NIGHT) then
			            zombiesActive = false
			 				-- kill zombie ???
																		
										ZombieFolder1:ClearAllChildren()
			ZombieFolder2:ClearAllChildren()

			ZombieFolder3:ClearAllChildren()


			        end    
		 
			    elseif (newClockTime  >= TIME_NIGHT or (newClockTime > 0 and newClockTime < TIME_DAY)) then -- If zombies aren't spawned, we check if the ClockTime is night to spawn them.
		        zombiesActive = true
	 
			-- spawn zombie
							ZombieT1Copy.Parent = game.workspace.WorkspaceEnemys.T1_Midnight_G1	
					
						ZombieT1Group2Copy.Parent = game.workspace.WorkspaceEnemys.T1_Midnight_G2

							ZombieT1Group3Copy.Parent = game.workspace.WorkspaceEnemys.T1_Midnight_G3
				
						

		
    end
	end
	LightingService:GetPropertyChangedSignal("ClockTime"):Connect(ClockTimeChanged) --




----   ClonedT1.Position = Vector3.new(123, 123, 123)
						-- position to use later

THEY NEED TO RESPAWN INFINITLY!

3 comments

0

where is the script located

0

after the zombies has been destroyed and want to respawn them, you need to clone them again

0

script is located at ServerScriptService