War

card codec

War
Mar 16th, 2017
660
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.50 KB | None | 0 0
  1. local deb = false
  2. local continue = false
  3. local CardNumber = {510,627} --first number must be room number!
  4.  
  5. script.Parent:WaitForChild("Door"):WaitForChild("DoorNum"):WaitForChild("SurfaceGui"):WaitForChild("TextLabel").Text = CardNumber[1]
  6.  
  7. function Swipe1(Card)
  8.     Card.Transparency = 1
  9.     Card.SurfaceGui.Enabled = false
  10.     local a = script.Parent.RFID1.Key:Clone()
  11.     a.Parent = script.Parent.RFID1
  12.     a.SurfaceGui.Enabled = true
  13.     a.Transparency = 0
  14.     for i=1,25 do
  15.         wait(0.005)
  16.         a.CFrame = a.CFrame * CFrame.new(0.04,0,0)
  17.     end
  18.     a:Destroy()
  19.     Card.Transparency = 0
  20.     Card.SurfaceGui.Enabled = true
  21. end
  22.  
  23. function unlock1(Card)
  24. if Card == nil then return end
  25. if Card.Parent == nil then return end
  26. if Active then return end
  27.     Active = true
  28.         if Card.Parent:FindFirstChild("CardNumber") ~= nil then
  29.             Swipe1(Card)
  30.             for id=1, #CardNumber do           
  31.                 if Card.Parent.CardNumber.Value == CardNumber[id] then
  32.                     Accepted = true
  33.                 end
  34.             wait()
  35.             end
  36.             if Accepted then
  37.                 script.Parent.RFID1.LED.BrickColor = BrickColor.new("Lime green")
  38.                 script.Parent.allowed.Value = true
  39.                 wait(2)
  40.                 script.Parent.RFID1.LED.BrickColor = BrickColor.new("Bright orange")
  41.                 script.Parent.allowed.Value = false
  42.             end
  43.             if not Accepted then
  44.                 script.Parent.RFID1.LED.BrickColor = BrickColor.new("Really red")
  45.                 wait(2)
  46.                 script.Parent.RFID1.LED.BrickColor = BrickColor.new("Bright orange")
  47.             end
  48.             Accepted = false
  49.         end
  50. Active = false
  51. end
  52.  
  53. script.Parent.RFID1.Union.Touched:connect(unlock1)
Advertisement
Add Comment
Please, Sign In to add comment