Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local isOn = false
- function on()
- isOn = true
- while true do
- script.Parent.Button1.BrickColor = BrickColor.new("Bright red")
- for i = 9, 20 do
- script.Parent.Door.CFrame=CFrame.new(-29.5,i,106.5)
- wait(.05)
- end
- wait(2)
- for i = 1, 11 do
- script.Parent.Door.CFrame=CFrame.new(-29.5,20-i,106.5)
- wait(.05)
- isOn = false
- end
- end
- end
- function off()
- isOn = false
- script.Parent.Button1.BrickColor = BrickColor.new("Bright green")
- end
- function onClicked()
- if isOn == true then
- off()
- else
- on()
- end
- end
- script.Parent.Button1.ClickDetector.MouseClick:connect(onClicked)
- off()
Add Comment
Please, Sign In to add comment