Nevermind. After compiling in the Applescript editor, I didn't save the file again. Therefore osascript mentioned that it has uncompiled changes and can't be run like this.
Therefore, both of the commands work. If you encounter similar problems, make sure you have compiled & saved the file.