--☻☻☻☻☻☻☻


local P1 = script.Parent.PivotL
local P2 = script.Parent.PivotR
local TS = game:GetService("TweenService")

local CD1 = Instance.new("ClickDetector",script.Parent.L)
local CD2 = Instance.new("ClickDetector",script.Parent.R)

local toggle = false
local deb = false
local function Box()
	if not deb then
		deb = true
		if toggle == false then
			TS:Create(P1,
				TweenInfo.new(2,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut,0,false,0),
				{CFrame = P1.CFrame * CFrame.Angles(math.rad(160),0,0)}
			):Play()
			local t1 = TS:Create(P2,
				TweenInfo.new(2,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut,0,false,0),
				{CFrame = P2.CFrame * CFrame.Angles(math.rad(-170),0,0)}
			)
			t1.Completed:Connect(function()
				toggle = not toggle
				deb = false
			end)
			t1:Play()
		else
			TS:Create(P1,
				TweenInfo.new(2,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut,0,false,0),
				{CFrame = P1.CFrame * CFrame.Angles(math.rad(-160),0,0)}
			):Play()
			local t1 = TS:Create(P2,
				TweenInfo.new(2,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut,0,false,0),
				{CFrame = P2.CFrame * CFrame.Angles(math.rad(170),0,0)}
			)
			t1.Completed:Connect(function()
				toggle = not toggle
				deb = false
			end)
			t1:Play()
		end
	end
end

CD1.MouseClick:Connect(function()
	Box()
end)

CD2.MouseClick:Connect(function()
	Box()
end)
