Advertisement
Guest User

Untitled

a guest
Apr 6th, 2020
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.63 KB | None | 0 0
  1.  
  2. local PowerOn = true
  3. local PowerButton = game:GetService("Workspace").PowerButton.PowerShutoff.Detect
  4. local PowerValue = game:GetService("Workspace").Power
  5.  
  6. local Rotation = 0.1
  7.  
  8. local Debounce = false
  9.  
  10. PowerButton.MouseClick:connect(function(Player)
  11.     if not Debounce and Player.Team == (game:GetService("Teams"):WaitForChild("Team") or game:GetService("Teams"):WaitForChild("Security [C-Beta]")) or Player.Team == (game:GetService("Teams"):WaitForChild("Team2") or game:GetService("Teams"):WaitForChild("Team3")) then
  12.         if PowerOn then
  13.             Debounce = true
  14.             for Index,Obj in pairs(game:GetService("Workspace"):GetChildren()) do
  15.                 if Obj.Name == "LIGHT" then
  16.                     local Light = Obj:WaitForChild("PointLight")
  17.                     Light.Enabled = false
  18.                 end
  19.             end
  20.             for Index,Obj in pairs(workspace:GetChildren()) do
  21.                 if Obj:IsA("Model") and Obj.Name == "EmergencyLight" then
  22.                     local RotPart = Obj:WaitForChild("Rotate")
  23.                     RotPart.SpotLight.Enabled = true
  24.                 elseif Obj:IsA("Model") and Obj.Name == "Alarm" then
  25.                     Obj.music:Stop()
  26.                 end
  27.             end
  28.             PowerOn = false
  29.             PowerValue.Value = false
  30.             game:GetService("Workspace"):WaitForChild("Engine"):WaitForChild("EngineMoving"):WaitForChild("TURN").RightParamB = 0
  31.             for Index,Obj in pairs(workspace.SOUNDPIECES:GetChildren()) do
  32.                 Obj.Sound:Stop()
  33.             end
  34.             delay(60, function()
  35.                 Debounce = false
  36.             end)
  37.         else
  38.             Debounce = true
  39.             for Index,Obj in pairs(game:GetService("Workspace"):GetChildren()) do
  40.                 if Obj.Name == "LIGHT" then
  41.                     local Light = Obj:WaitForChild("PointLight")
  42.                     Light.Enabled = true
  43.                 end
  44.             end
  45.             for Index,Obj in pairs(workspace:GetChildren()) do
  46.                 if Obj:IsA("Model") and Obj.Name == "EmergencyLight" then
  47.                     local RotPart = Obj:WaitForChild("Rotate")
  48.                     RotPart.SpotLight.Enabled = false
  49.                 end
  50.             end
  51.             PowerOn = true
  52.             PowerValue.Value = true
  53.             for Index,Obj in pairs(workspace.SOUNDPIECES:GetChildren()) do
  54.                 Obj.Sound:Play()
  55.             end
  56.             game:GetService("Workspace"):WaitForChild("Engine"):WaitForChild("EngineMoving"):WaitForChild("TURN").RightParamB = 0.5
  57.             delay(2,function()
  58.                 game:GetService("Workspace"):WaitForChild("Engine"):WaitForChild("EngineMoving"):WaitForChild("TURN").RightParamB = 0.25
  59.             end)
  60.             delay(60, function()
  61.                 Debounce = false
  62.             end)
  63.         end
  64.     end
  65. end)
  66.  
  67. game:GetService("RunService").Stepped:connect(function()
  68.     if not PowerOn then
  69.         for Index,Obj in pairs(workspace:GetChildren()) do
  70.             if Obj:IsA("Model") and Obj.Name == "EmergencyLight" then
  71.                 local RotPart = Obj:WaitForChild("Rotate")
  72.                 RotPart.CFrame = RotPart.CFrame * CFrame.Angles(Rotation,0,0)
  73.             end
  74.         end
  75.     end
  76. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement