Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local online = script.Parent.Online
- local broken = script.Parent.broken
- local techteam = game.Teams["Manufacturing Department"]
- local debounce = false
- local model = script.Parent.Parent
- local humsound = model.Body.Sound
- local sector = model.Name
- local alarm = model.Status.Alarm
- local function setbroken(state)
- if state == true then
- if model.Debris.Transparency == 1 then
- model.Debris.Sound:Play()
- model.Debris.Transparency = 0
- model.Debris.Smoke.Enabled = true
- model.Debris.Sparkles.Enabled = true
- model.Debris.ClickDetector.MaxActivationDistance = 10
- -------------
- model.Panel.Transparency = 1
- end
- else
- model.Debris.Transparency = 1
- model.Debris.ClickDetector.MaxActivationDistance = 0
- model.Debris.Smoke.Enabled = false
- model.Debris.Sparkles.Enabled = false
- -------------
- model.Panel.Transparency = 0
- end
- end
- local function update()
- setbroken(broken.Value)
- if broken.Value == true then
- online.Value = false
- end
- game.ReplicatedStorage.LightStatus:FindFirstChild(sector).Value = online.Value
- if online.Value == true then
- humsound:Play()
- alarm:Stop()
- model.Status.BrickColor = BrickColor.new("Lime green")
- elseif broken.Value == true then
- humsound:Stop()
- alarm:Play()
- model.Status.BrickColor = BrickColor.new("Bright yellow")
- else
- humsound:Stop()
- alarm:Stop()
- model.Status.BrickColor = BrickColor.new("Really red")
- end
- end
- model.Screen.ClickDetector.MouseClick:Connect(function(plr)
- if debounce == true then
- return
- end
- debounce = true
- if broken.Value == true then
- return
- end
- ------------
- if plr.Team == techteam then
- online.Value = not online.Value
- model.Status.Sound:Play()
- update()
- wait(5)
- end
- debounce = false
- end)
- wait(0.2)
- update()
- broken.Changed:Connect(function()
- update()
- end)
- model.Debris.ClickDetector.MouseClick:Connect(function(plr)
- for i, box in pairs(workspace.Fusebox:GetChildren()) do
- if box.Name == model.Name then
- if box.Broken.Value == true then
- print("fuseboxes still broken")
- return
- end
- end
- end
- if plr.Team == techteam then
- if broken.Value == true then
- broken.Value = false
- end
- end
- end)
- while true do
- wait(1)
- for i, box in pairs(workspace.Fusebox:GetChildren()) do
- if box.Name == model.Name then
- if box.Broken.Value == true and broken.Value == false then
- print("Found broken box")
- broken.Value = true
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment