Chest = script.Parent Lid = Chest.Lid Lid.PrimaryPart = Lid.Hinge increment = 96 debounce = false function rotate(model, amount) for i=1, math.abs(amount/1.7) 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 for i,v in pairs(Lid:GetChildren()) do if v.Name == "ClickSensor" then v.ClickEvent.OnServerEvent:connect(openChest) end end
--This chest uses a script that makes ClickDetectors compatible with FilteringEnabled.
I'm unsure how to make the speed of the door opening faster