local function D(D)local d=script.Click:Clone()d.Parent=D d:Play()D.Size=Vector3.new(.8,.8,.01)wait(.2)D.Size=Vector3.new(.8,.8,.1)d:Destroy()end local function d()Text.Text=""EnteredText.Value=Text.Text end for d,c in pairs((Board:WaitForChild("\078\117\109\098\101\114\115")):getChildren())do c.ClickDetector.MouseClick:Connect(function()D(c)if string.len(Text.Text)<string.len(Code)then Text.Text=Text.Text..c.Name EnteredText.Value=Text.Text else Text.Text=c.Name EnteredText.Value=Text.Text end end)end OtherButtons.Enter.ClickDetector.MouseClick:Connect(function()D(OtherButtons.Enter)if EnteredText.Value==Code then OtherButtons.Enter.Approved:Play()d()for D=1,10,1 do Door.Door.Transparency=Door.Door.Transparency+.1 wait()end Door.Door.CanCollide=false wait(3)Door.Door.CanCollide=true for D=1,10,1 do Door.Door.Transparency=Door.Door.Transparency-.1 wait()end else OtherButtons.Enter.Denied:Play()d()end end)OtherButtons.Clear.ClickDetector.MouseClick:Connect(function()D(OtherButtons.Clear)d()end)

local function ButtonPress(Button)
	local Sound = script.Click:Clone()
	Sound.Parent = Button
	Sound:Play()
	Button.Size = Vector3.new(0.8, 0.8, .01)
	wait(.2)
	Button.Size = Vector3.new(0.8, 0.8, 0.1)
	Sound:Destroy()
end

local function Clear()
	Text.Text = ""
	EnteredText.Value = Text.Text
end

for i, v in pairs(Board:WaitForChild("Numbers"):getChildren()) do
	v.ClickDetector.MouseClick:Connect(function()
		ButtonPress(v)
		if string.len(Text.Text) < string.len(Code) then
			Text.Text = Text.Text..v.Name
			EnteredText.Value = Text.Text
		else
			Text.Text = v.Name
			EnteredText.Value = Text.Text
		end
	end)
end

OtherButtons.Enter.ClickDetector.MouseClick:Connect(function()
	ButtonPress(OtherButtons.Enter)
	if EnteredText.Value == Code then
		OtherButtons.Enter.Approved:Play()
		Clear()
		for count = 1, 10 do
			Door.Door.Transparency = Door.Door.Transparency + .1
			wait()
		end
		Door.Door.CanCollide = false
		wait(3)
		Door.Door.CanCollide = true
		for count = 1, 10 do
			Door.Door.Transparency = Door.Door.Transparency - .1
			wait()
		end
	else
		OtherButtons.Enter.Denied:Play()
		Clear()
	end
end)

OtherButtons.Clear.ClickDetector.MouseClick:Connect(function()
	ButtonPress(OtherButtons.Clear)
	Clear()
end)
