Library creation with protection (SOLVED)

I finally have this solved! Turns out the password function must be in the beginning of the script not the end or it will not work.