Closed=true function LockUnlock()if script.Parent.Locked.Value==true then script.Parent.SwitchArm.Interactive.ClickDetector.MaxActivationDistance=0 else script.Parent.SwitchArm.Interactive.ClickDetector.MaxActivationDistance=10 end end script.Parent.Enclosure.Touched:connect(function(w)if w~=nil and(w.Parent~=nil and(w.Parent:FindFirstChild("\067\097\114\100\078\117\109\098\101\114")~=nil and w.Parent.CardNumber.Value==0))then if Closed==true then script.Parent.Locked.Value=false Closed=1 LockUnlock()wait(1)Closed=false return end if Closed==false then script.Parent.Locked.Value=true Closed=1 LockUnlock()wait(1)Closed=true return end end end)LockUnlock()
--LockController

Closed = true

function LockUnlock()
	if script.Parent.Locked.Value == true then
		script.Parent.SwitchArm.Interactive.ClickDetector.MaxActivationDistance = 0
	else
		script.Parent.SwitchArm.Interactive.ClickDetector.MaxActivationDistance = 10
	end
end

script.Parent.Enclosure.Touched:connect(function(P)
	if
		P ~= nil
		and P.Parent ~= nil
		and P.Parent:FindFirstChild("CardNumber") ~= nil
		and P.Parent.CardNumber.Value == 0
	then
		if Closed == true then
			script.Parent.Locked.Value = false
			Closed = 1
			LockUnlock()
			wait(1)
			Closed = false
			return
		end
		if Closed == false then
			script.Parent.Locked.Value = true
			Closed = 1
			LockUnlock()
			wait(1)
			Closed = true
			return
		end
	end
end)

LockUnlock() --Check
