-- lock yourself in the locker, be sealed away foreverrr....


local p1 = script.Parent.Pivot1
local p2 = script.Parent.Pivot2
local TS = game:GetService("TweenService")
local deb = false
local toggled = false

local cd1= Instance.new("ClickDetector",script.Parent.Handle1)
cd1.MaxActivationDistance = 5
local cd1_2 = Instance.new("ClickDetector",script.Parent.Handle2)
cd1_2.MaxActivationDistance = 5
local cd2 = Instance.new("ClickDetector",script.Parent.Door1)
cd2.MaxActivationDistance = 5
local cd2_2 = Instance.new("ClickDetector",script.Parent.Door2)
cd2_2.MaxActivationDistance = 5
local cf1 = p1.CFrame
local cf2 = p2.CFrame

local function locker()
	if not deb then
		deb = true
		local anim1
		local anim2
		if not toggled then
			anim1 = TS:Create(p1,
				TweenInfo.new(1.5,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut,0,false,0),
				{CFrame = cf1 * CFrame.Angles(-math.rad(150),0,0)}
			)
			anim2 = TS:Create(p2,
				TweenInfo.new(1.5,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut,0,false,0),
				{CFrame = cf2 * CFrame.Angles(math.rad(150),0,0)}
			)
		else
			anim1 = TS:Create(p1,
				TweenInfo.new(1.5,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut,0,false,0),
				{CFrame = cf1}
			)
			anim2 = TS:Create(p2,
				TweenInfo.new(1.5,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut,0,false,0),
				{CFrame = cf2}
			)
		end
		anim1.Completed:Connect(function()
			toggled = not toggled
			deb = false
		end)
		anim1:Play()
		anim2:Play()
	end
end

cd1.MouseClick:Connect(function()
	locker()
end)
cd1_2.MouseClick:Connect(function()
	locker()
end)
cd2.MouseClick:Connect(function()
	locker()
end)
cd2_2.MouseClick:Connect(function()
	locker()
end)
