Guest User

Untitled

a guest
Dec 17th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.62 KB | None | 0 0
  1. local isOn = false
  2.  
  3. function on()
  4.     isOn = true
  5.     while true do
  6.         script.Parent.Button1.BrickColor = BrickColor.new("Bright red")
  7.         for i = 9, 20 do
  8.             script.Parent.Door.CFrame=CFrame.new(-29.5,i,106.5)
  9.             wait(.05)
  10.         end
  11.         wait(2)
  12.         for i = 1, 11 do
  13.             script.Parent.Door.CFrame=CFrame.new(-29.5,20-i,106.5)
  14.             wait(.05)
  15.             isOn = false
  16.         end
  17.     end
  18. end
  19.  
  20. function off()
  21.     isOn = false
  22.     script.Parent.Button1.BrickColor = BrickColor.new("Bright green")
  23. end
  24.  
  25. function onClicked()
  26.     if isOn == true then
  27.         off()
  28.     else
  29.         on()
  30.     end
  31. end
  32.  
  33. script.Parent.Button1.ClickDetector.MouseClick:connect(onClicked)
  34.  
  35. off()
Add Comment
Please, Sign In to add comment