Advertisement
Guest User

Untitled

a guest
Dec 15th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. ----------------------------------------------------------------
  2.  
  3. oh,om = 6,00 -- Opening time (hours,minutes)
  4. ch,cm = 18,00 -- Closing time (hours,minutes)
  5. lightblockname = "LightBulb"
  6. modelname = "StreetLight"
  7. waittime = 1
  8.  
  9. ----------------------------------------------------------------
  10.  
  11.  
  12.  
  13. local l = game.Lighting
  14. local ot = (oh + (om/60)) * 60
  15. local ct = (ch + (cm/60)) * 60
  16. local c = game.Workspace:GetChildren()
  17.  
  18. while true do
  19. if (l:GetMinutesAfterMidnight() >= ot) and (l:GetMinutesAfterMidnight() <= ct) then
  20. for i = 1,#c do
  21. if c[i].Name == lightblockname then
  22. if c[i]:FindFirstChild("PointLight") ~= nil then
  23. c[i].PointLight.Enabled = false
  24. end
  25. if c[i]:FindFirstChild("SpotLight") ~= nil then
  26. c[i].SpotLight.Enabled = false
  27. end
  28. elseif c[i].Name == modelname then
  29. local mc = c[i]:GetChildren()
  30. for i = 1, #mc do
  31. if mc[i].Name == lightblockname then
  32. if mc[i]:FindFirstChild("PointLight") ~= nil then
  33. mc[i].PointLight.Enabled = false
  34. end
  35. if mc[i]:FindFirstChild("SpotLight") ~= nil then
  36. mc[i].SpotLight.Enabled = false
  37. end
  38. end
  39. end
  40. end
  41. end
  42. elseif (l:GetMinutesAfterMidnight() <= ot) or (l:GetMinutesAfterMidnight() >= ct) then
  43. for i = 1,#c do
  44. if c[i].Name == lightblockname then
  45. if c[i]:FindFirstChild("PointLight") ~= nil then
  46. c[i].PointLight.Enabled = true
  47. end
  48. if c[i]:FindFirstChild("SpotLight") ~= nil then
  49. c[i].SpotLight.Enabled = true
  50. end
  51. elseif c[i].Name == modelname then
  52. local mc = c[i]:GetChildren()
  53. for i = 1, #mc do
  54. if mc[i].Name == lightblockname then
  55. if mc[i]:FindFirstChild("PointLight") ~= nil then
  56. mc[i].PointLight.Enabled = true
  57. end
  58. if mc[i]:FindFirstChild("SpotLight") ~= nil then
  59. mc[i].SpotLight.Enabled = true
  60. end
  61. end
  62. end
  63. end
  64. end
  65. end
  66. wait(waittime)
  67. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement