domingothegamer

Roblox door auto closing

Dec 25th, 2011
416
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.71 KB | None | 0 0
  1. --Put this script inside the Door Brick. :3
  2. print("Door Script running")
  3. local door = script.Parent
  4. local debounce = false
  5. local debounce2 = false
  6.  
  7. function OnClicked()
  8.  
  9. if debounce == false then
  10.     debounce = true --to kick off flooding
  11.     door.Transparency = 0.6
  12.     door.CanCollide = false --Door is opening!
  13.     wait(4)
  14.     door.Transparency = 0
  15.     door.CanCollide = true --Door is closed
  16.     debounce = false
  17. elseif debounce == true and debounce2 == false then --Incase player is impatient and wants to close it himself early. :3
  18.     debounce2 = true --to kick off more flooding
  19.     door.Transparency = 0
  20.     door.CanCollide = true
  21.     wait(4)
  22.     debounce2 = false
  23. end
  24. end
  25.  
  26. door.ClickDetector.MouseClick:connect(OnClicked)
Advertisement
Add Comment
Please, Sign In to add comment