--Defining the parts of the shelf

local sp=script.Parent
local drawer=sp.DrawerModel.Drawer
local val = script.bool.Value
function onClicked(clicked)

	if val == true then
		val = false
		drawer.ClickDetector.MaxActivationDistance=0
		drawer.Sound:Play()
		for loop = 1, 20 do
		sp:SetPrimaryPartCFrame(sp.PrimaryPart.CFrame * CFrame.new(0, 0,-.1) * CFrame.fromEulerAnglesXYZ(0, 0, 0))
		wait(0.05)
		end
		val = false
		drawer.ClickDetector.MaxActivationDistance=5

	elseif val == false then
		val = true
		drawer.ClickDetector.MaxActivationDistance=0
		drawer.Sound:Play()
		for loop = 1, 20 do
		sp:SetPrimaryPartCFrame(sp.PrimaryPart.CFrame * CFrame.new(0, 0, .1) * CFrame.fromEulerAnglesXYZ(0, 0, 0))
		wait(0.05)
		end
		val = true
		drawer.ClickDetector.MaxActivationDistance=5
		end
		end

drawer.ClickDetector.MouseClick:connect(onClicked)
