Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- doors
- local model = Workspace
- local dArray = {
- model.Door1,
- model.Door2,
- model.Door3,
- model.Door4,
- }
- -- windows
- local wArray = {
- model.Window1,
- model.Window2,
- model.Window3,
- model.Window4,
- model.Window5,
- model.Window6,
- model.Window7,
- }
- -- cd etc.
- local button = script.Parent
- local cd = button.ClickDetector
- local wc = nil
- local wt = nil
- local dc = nil
- local dt = nil
- local deb = false
- function shutter(brick)
- wc = brick.BrickColor
- wt = brick.Transparency
- brick.BrickColor = BrickColor.DarkGray()
- brick.Transparency = 0
- end
- function unshutter(brick)
- brick.BrickColor = wc
- brick.Transparency = wt
- end
- function lockdoors(door)
- dc = door.Left.BrickColor
- dt = door.Left.Transparency
- door.Left.BrickColor = BrickColor.DarkGray()
- door.Right.BrickColor = BrickColor.DarkGray()
- door.Left.Transparency = 0
- door.Right.Transparency = 0
- door.Sensor.Script.Disabled = true
- end
- function unlockdoors(door)
- door.Left.BrickColor = dc
- door.Right.BrickColor = dc
- door.Left.Transparency = dt
- door.Right.Transparency = dt
- door.Sensor.Script.Disabled = false
- end
- function lock()
- _G.offb_ms_off()
- wait(0.1)
- _G.offb_ms_on("LOCKDOWN ACTIVATED!")
- -- shutter windows
- local wCounts = 0
- while wCounts < #wArray do
- wCounts = wCounts + 1
- shutter(wArray[wCounts])
- end
- -- lock doors
- local dCounts = 0
- while dCounts < #dArray do
- dCounts = dCounts + 1
- lockdoors(dArray[dCounts])
- end
- end
- function unlock()
- _G.offb_ms_off()
- wait(0.1)
- -- unshutter windows
- local wCounts = 0
- while wCounts < #wArray do
- wCounts = wCounts + 1
- unshutter(wArray[wCounts])
- end
- -- unlock doors
- local dCounts = 0
- while dCounts < #dArray do
- dCounts = dCounts + 1
- unlockdoors(dArray[dCounts])
- end
- end
- local usedbefore = false
- active = false
- cd.MouseClick:connect(function()
- if deb ~= true then
- deb = true
- if usedbefore == false then
- usedbefore = true
- active = true
- lock()
- button.BrickColor = BrickColor.Red()
- else
- if active == true then
- active = false
- unlock()
- button.BrickColor = BrickColor.Green()
- else
- active = true
- lock()
- button.BrickColor = BrickColor.Red()
- end
- end
- wait(2)
- deb = false
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement