It depends on the script. The script is triggered not by your shell which has your path and environment information, but other path and environment information. Echo out the environment information to a debug log file when the script runs.
Check that against what you have in your user environment.
You also need to get to the bottom of what command is not being found. Do you get a line number? Or is the script one line only? Either case, find out what command is being rejected.
A final point is that for most scripts I include the full pathname for all executable commands.
Instead of "ls" I use "/bin/ls" because ls is located in the /bin directory. If you're unsure, when in your shell, perform
to get the path for the command you're running from within the script and then place that path into the script file.