Advertisement
LawMixer

This is the main script.

Sep 17th, 2020
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. game.ReplicatedStorage.LightStatus.Sector1.Changed:Connect(function()
  2. for i, light in pairs(workspace:GetDescendants()) do
  3. if light.Name == "FacilityLight1" then
  4. wait()
  5. light.SpotLight.Enabled = game.ReplicatedStorage.LightStatus.Sector1.Value
  6. script.sfx:Clone().Parent = light
  7. light.sfx:Play()
  8. if light.SpotLight.Enabled == false then
  9. light.Material = "Glass"
  10. else
  11. light.Material = "Neon"
  12. end
  13.  
  14. end
  15. end
  16.  
  17. end)
  18. game.ReplicatedStorage.LightStatus.Sector2.Changed:Connect(function()
  19. for i, light in pairs(workspace:GetDescendants()) do
  20. if light.Name == "FacilityLight2" then
  21. wait()
  22. light.SpotLight.Enabled = game.ReplicatedStorage.LightStatus.Sector2.Value
  23. script.sfx:Clone().Parent = light
  24. light.sfx:Play()
  25. if light.SpotLight.Enabled == false then
  26. light.Material = "Glass"
  27. else
  28. light.Material = "Neon"
  29. end
  30. elseif light.Name == "Light_C_Q1" then
  31. wait()
  32. light.Bulb.SpotLight.Enabled = game.ReplicatedStorage.LightStatus.Sector2.Value
  33. script.sfx:Clone().Parent = light.Bulb
  34. light.Bulb.sfx:Play()
  35. if light.Bulb.SpotLight.Enabled == false then
  36. light.Bulb.Material = "Glass"
  37. else
  38. light.Bulb.Material = "Neon"
  39. end
  40.  
  41. end
  42. end
  43. end)
  44.  
  45. game.ReplicatedStorage.LightStatus.Sector3.Changed:Connect(function()
  46. for i, light in pairs(workspace:GetDescendants()) do
  47. if light.Name == "FacilityLight3" then
  48. wait()
  49. light.SpotLight.Enabled = game.ReplicatedStorage.LightStatus.Sector3.Value
  50. script.sfx:Clone().Parent = light
  51. light.sfx:Play()
  52. if light.SpotLight.Enabled == false then
  53. light.Material = "Glass"
  54. else
  55. light.Material = "Neon"
  56. end
  57.  
  58. end
  59. end
  60.  
  61. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement