Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Services --
- local Lighting = game:GetService("Lighting")
- local Workspace_LightSources = game.Workspace:GetChildren()
- -- Basic Values --
- local Enabled_Material = Enum.Material.Neon -- Material when Source is on.
- local Disabled_Material = Enum.Material.SmoothPlastic -- Material when Source is off.
- -- Light Sources Handler --
- function LightChange(Status)
- if Status == true then
- for _,a in pairs (Workspace_LightSources) do
- if a.Name == "LightSource" then
- a.Material = Enabled_Material
- local LightChildren = a:GetChildren()
- for _,b in pairs (LightChildren) do
- if b.ClassName == "PointLight" or "SpotLight" or "SurfaceLight" then
- b.Enabled = true
- else
- return
- end
- end
- end
- end
- elseif Status == false then
- for _,a in pairs (Workspace_LightSources) do
- if a.Name == "LightSource" then
- a.Material = Disabled_Material
- local LightChildren = a:GetChildren()
- for _,b in pairs (LightChildren) do
- if b.ClassName == "PointLight" or "SpotLight" or "SurfaceLight" then
- b.Enabled = false
- else
- return
- end
- end
- end
- end
- end
- end
- -- Automatic Lighting --
- while true do
- wait(.1)
- local MinutesAfterMidnight = game.Lighting:GetMinutesAfterMidnight()
- game.Lighting:SetMinutesAfterMidnight(MinutesAfterMidnight + 10)
- if MinutesAfterMidnight > (18 * 60) or MinutesAfterMidnight < (5.5 * 60) then
- LightChange(true)
- elseif MinutesAfterMidnight < (18 * 60) or MinutesAfterMidnight > (5.5 * 60) then
- LightChange(false)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment