--Itochu Code Panel Script

Codes = {1234,1337,9001} --Your code(Support multiple codes)
Input = ""

InputDisabled = false
Code = true

Panel = script.Parent

if Code then Panel.Code.Material = "Neon" end

function DoInput(Data)
	if InputDisabled or not Code then return end
	if string.len(Input) ~= 4 then
		Input = Input..Data
	end
	if string.len(Input) == 4 then
		local Accepted = false
		for _,l in pairs(Codes) do
			if tostring(l) == Input then Accepted = true end
		end
		if Accepted then 
			Panel.Code.Material = "SmoothPlastic"
			Panel.Access.Material = "Neon"
			YourFunc()
		else
			Panel.Code.Material = "SmoothPlastic"
			Panel.Denied.Material = "Neon"
		end
		wait(2)
		Input = ""
		if Code then
			Panel.Code.Material = "Neon"
		end
		Panel.Access.Material = "SmoothPlastic"
			Panel.Denied.Material = "SmoothPlastic"
	end
end

function YourFunc() --Script your function here
	script.Parent.Parent.Open.Value = true --For Teknikk Automatic Door
end

for _,l in pairs(script.Parent:GetChildren()) do
	if l.Name:sub(1,3) == "BTN" then
		l.ClickDetector.mouseClick:connect(function()
			DoInput(tonumber(l.Name:sub(4)))	
		end)	
	end
end


for _,l in pairs(script.Parent:GetChildren()) do
	if l.Name:sub(1,2) == "BT" then
		l.ClickDetector.mouseClick:connect(function()
			Panel.Main.Beep:Play()
		end)	
	end
end
