Chest=script.Parent Lid=Chest.Lid Lid.PrimaryPart=Lid.Hinge increment=96 debounce=false function rotate(d,u)for x=1,math.abs(u/2),1 do d:SetPrimaryPartCFrame(d.Hinge.CFrame*CFrame.fromEulerAnglesXYZ(0,math.pi/u,0))wait()end end function openChest()print("\067\108\105\099\107\101\100 \111\110 \104\097\110\100\108\101\046")if not debounce then debounce=true if Chest.Open.Value then rotate(Lid,increment)else rotate(Lid,-increment)end Chest.Open.Value=not Chest.Open.Value debounce=false else end end Lid.ClickDetector.MouseClick:Connect(openChest)
--AdmiralLennox
Chest = script.Parent
Lid = Chest.Lid
Lid.PrimaryPart = Lid.Hinge

increment = 96
debounce = false

function rotate(model, amount)
	for i = 1, math.abs(amount / 2) do
		model:SetPrimaryPartCFrame(model.Hinge.CFrame * CFrame.fromEulerAnglesXYZ(0, math.pi / amount, 0))
		wait()
	end
end

function openChest()
	print("Clicked on handle.")

	if not debounce then
		debounce = true
		if Chest.Open.Value then
			rotate(Lid, increment)
		else
			rotate(Lid, -increment)
		end
		Chest.Open.Value = not Chest.Open.Value
		debounce = false
	else
	end
end

Lid.ClickDetector.MouseClick:Connect(openChest)
