-- booooriiiiing


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.L)
local cd2 = Instance.new("ClickDetector",script.Parent.R)
cd1.MaxActivationDistance = 5
cd2.MaxActivationDistance = 5
local cf1 = p1.CFrame
local cf2 = p2.CFrame

local function box() -- full of chickenpox! ☻☻☻☻
	if not deb then
		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(160),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()
	box()
end)
cd2.MouseClick:Connect(function()
	box()
end)
