Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ----------------------------------------------------------------
- oh,om = 6,00 -- Opening time (hours,minutes)
- ch,cm = 18,00 -- Closing time (hours,minutes)
- lightblockname = "LightBulb"
- modelname = "StreetLight"
- waittime = 1
- ----------------------------------------------------------------
- local l = game.Lighting
- local ot = (oh + (om/60)) * 60
- local ct = (ch + (cm/60)) * 60
- local c = game.Workspace:GetChildren()
- while true do
- if (l:GetMinutesAfterMidnight() >= ot) and (l:GetMinutesAfterMidnight() <= ct) then
- for i = 1,#c do
- if c[i].Name == lightblockname then
- if c[i]:FindFirstChild("PointLight") ~= nil then
- c[i].PointLight.Enabled = false
- end
- if c[i]:FindFirstChild("SpotLight") ~= nil then
- c[i].SpotLight.Enabled = false
- end
- elseif c[i].Name == modelname then
- local mc = c[i]:GetChildren()
- for i = 1, #mc do
- if mc[i].Name == lightblockname then
- if mc[i]:FindFirstChild("PointLight") ~= nil then
- mc[i].PointLight.Enabled = false
- end
- if mc[i]:FindFirstChild("SpotLight") ~= nil then
- mc[i].SpotLight.Enabled = false
- end
- end
- end
- end
- end
- elseif (l:GetMinutesAfterMidnight() <= ot) or (l:GetMinutesAfterMidnight() >= ct) then
- for i = 1,#c do
- if c[i].Name == lightblockname then
- if c[i]:FindFirstChild("PointLight") ~= nil then
- c[i].PointLight.Enabled = true
- end
- if c[i]:FindFirstChild("SpotLight") ~= nil then
- c[i].SpotLight.Enabled = true
- end
- elseif c[i].Name == modelname then
- local mc = c[i]:GetChildren()
- for i = 1, #mc do
- if mc[i].Name == lightblockname then
- if mc[i]:FindFirstChild("PointLight") ~= nil then
- mc[i].PointLight.Enabled = true
- end
- if mc[i]:FindFirstChild("SpotLight") ~= nil then
- mc[i].SpotLight.Enabled = true
- end
- end
- end
- end
- end
- end
- wait(waittime)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement