War

D2

War
Mar 16th, 2017
648
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.75 KB | None | 0 0
  1. local a = script.Parent.Door:GetChildren()
  2.  
  3. for i=1,#a do
  4.     wait()
  5.     if a[i].ClassName == 'Part' or a[i].ClassName == "UnionOperation" then
  6.     local b = Instance.new("NumberValue")
  7.     b.Parent = a[i]
  8.     b.Name = "Transp"
  9.     b.Value = a[i].Transparency
  10.     end
  11. end
  12.  
  13. function open()
  14.     for i=1,#a do
  15.         a[i].Transparency = 1
  16.         a[i].CanCollide = false
  17.     end
  18. end
  19.  
  20. function close()
  21.     for i=1,#a do
  22.         a[i].Transparency = a[i].Transp.Value
  23.         a[i].CanCollide = true
  24.     end
  25. end
  26.  
  27. script.Parent.allowed.Changed:connect(function()
  28.     if script.Parent.allowed.Value == true then
  29.         open()
  30.     else
  31.         close()
  32.     end
  33. end)
  34.  
  35. script.Parent.Open.ClickDetector.MouseClick:connect(function()
  36.     script.Parent.allowed.Value = true
  37.     wait(3)
  38.     script.Parent.allowed.Value = false
  39. end)
Advertisement
Add Comment
Please, Sign In to add comment