War icon

card codec

War | PRO | 03/16/17 10:15:09 PM UTC | 0 ⭐ | 633 👁️ | Never ⏰ | []
Lua |

1.5 KB

|

None

|

0 👍

/

0 👎

local deb = false
local continue = false
local CardNumber = {510,627} --first number must be room number!
 
script.Parent:WaitForChild("Door"):WaitForChild("DoorNum"):WaitForChild("SurfaceGui"):WaitForChild("TextLabel").Text = CardNumber[1]
 
function Swipe1(Card)
    Card.Transparency = 1
    Card.SurfaceGui.Enabled = false
    local a = script.Parent.RFID1.Key:Clone()
    a.Parent = script.Parent.RFID1
    a.SurfaceGui.Enabled = true
    a.Transparency = 0
    for i=1,25 do
        wait(0.005)
        a.CFrame = a.CFrame * CFrame.new(0.04,0,0)
    end
    a:Destroy()
    Card.Transparency = 0
    Card.SurfaceGui.Enabled = true
end
 
function unlock1(Card)
if Card == nil then return end
if Card.Parent == nil then return end
if Active then return end
    Active = true
        if Card.Parent:FindFirstChild("CardNumber") ~= nil then
            Swipe1(Card)
            for id=1, #CardNumber do            
                if Card.Parent.CardNumber.Value == CardNumber[id] then
                    Accepted = true
                end 
            wait()
            end
            if Accepted then
                script.Parent.RFID1.LED.BrickColor = BrickColor.new("Lime green")
                script.Parent.allowed.Value = true
                wait(2)
                script.Parent.RFID1.LED.BrickColor = BrickColor.new("Bright orange")
                script.Parent.allowed.Value = false
            end
            if not Accepted then
                script.Parent.RFID1.LED.BrickColor = BrickColor.new("Really red")
                wait(2)
                script.Parent.RFID1.LED.BrickColor = BrickColor.new("Bright orange")
            end
            Accepted = false
        end
Active = false
end
 
script.Parent.RFID1.Union.Touched:connect(unlock1)

Comments