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

How do I make a time script that spawns in a model during a current time?

Asked by
drcelt -3
4 years ago
Edited 4 years ago
local lighting = game:GetService("Lighting")
local Workspace = game:GetService("Workspace")
local rs = game:GetService("ReplicatedStorage")
local ss = game:GetService("ServerStorage")


local ClockTime = lighting.ClockTime

local sounds = Workspace.Sounds

local dayBrightness = 1000
local nightBrightness = 0
local dayLength = 150
local nightLength = 200
local dayFog = 700
local nightFog = 200

local rs = game:GetService("ReplicatedStorage")
local timeValues = rs.timeValues

while true do
    wait(5)
    -- //  Day  \\ --
    Workspace.Maps.Spawned:WaitForChild("Zombie").Parent = ss -- Move zombie
    ClockTime = 11 -- Changes time to day if not already
    lighting.Brightness = dayBrightness -- Changes brightness to make it brighter
    Workspace.Sounds.Fjords:Play() -- Play sound
    lighting.FogEnd = dayFog -- Changes fog
    wait(dayLength) -- Time to wait
    -- // Night :O \\ --
    ss.Zombie.Parent = Workspace.Maps.Spawned -- Spawn in zombie
    Workspace.Sounds.Fjords:Stop() -- Stop sound for day
    Workspace.Sounds.DeadSlience:Play() -- Play sound for night
    ClockTime = 4 -- Change clocktime
    lighting.Brightness = nightBrightness -- Brightness change
    lighting.FogEnd = nightFog -- FogEnd change
    Workspace.Sounds.DeadSlience:Stop() -- Stop sound
    wait(nightLength) -- How long night is
end

On the parts of spawning, I have no idea how to spawn it in if I don't know if its in workspace or not. It gives me a warn ingame of a Infinite Yield. I've tried to use if statements if its spawned in but it hasn't worked..

Answer this question