How to restore it to the ribbon?
It sounds like you are referring to the system Script menu in the menu bar. To show it:
In the Finder, choose Utilities from the Go menu and open the Script Editor application. Open its Preferences window. Click on the General tab, and make sure that Show Script menu in menu bar is checked. (You may have to uncheck and then check the box before the icon shows up in the menu bar.)