How to make a horizontal part hinge?

Managed to script the cover myself.