Permission bits apply separately to the owner, group and other users. Read, write and execute have values four, two and one in an octal digit.
A script may need execute permission for its owner without exposing it to everyone. Symbolic changes such as u+x edit selected bits; an octal mode sets the whole requested pattern. Don't treat 777 as a general repair.
Confirm the requested mode after changing it; a successful command alone doesn't describe the access you granted. For example, 640 gives the owner read and write access, the group read access, and other users none. On a directory, execute permission controls traversal, so readable filenames alone don't guarantee you can reach their contents. After chmod, inspect ls -l or stat to confirm both the intended access and the restrictions you kept.