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

How to implement to make zombies spawn?

Asked by 1 year ago

This is my script, how would I implement to make them spawn in the folder in workspace? I have been trying to do this for hours. And to obviously kill them after...

    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 ZombieT1 = game.ServerStorage.EnemyStore.T1.T1_Group1  -- PART TO CLONE

        local ClonedT1 = ZombieT1:Clone() -- cloned part    

            ClonedT1.Name = "T1-NoRespawnMidnight"

-------------------------------------------------------------------------------------------------

    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 ???
                            ZombieT1:Destroy()
                    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
                            ClonedT1.Parent = game.Workspace.WorkspaceEnemys.T1_Midnight_G1



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


Answer this question