Why does this code snippet have an unexpected token error?

This is my first foray into plugin development and JS in general so please be kind to what are probably very simple/obvious mistakes.

Code:
//=======================================================
// SaveTone.js
//=======================================================

/*:
 * @plugindesc Save and load screen tints with $gameScreen.saveTone() and $gameScreen.loadTone()
 * @author haley
 *
 * @help This plugin does not provide plugin commands.
*/

(function() {
      Game_Screen.prototype.saveTone = function() {
        this._savedTone = this._tone;
    };
   
    Game_Screen.prototype.loadTone = function(duration) {
        this.startTint(_savedTone, duration);
    };
   
    Game_Screen.prototype.toGrayscale = function(duration) {
        var temp = tone.clone();
        temp[3] = 255;
        this.startTint(temp, duration);
    };
  };

})();

On startup, i get this error logged to the console:
Fdy9vfX.png


and when I try to call any of the methods i get TypeError: undefined is not a function

Any help is appreciated.
Is that your exact script? Line 26 is this: }; Are there other lines to the error message?

Which methods are you calling, and where and how? You probably get the error because the plugin has an error, so hasn't been loaded (your functions do not "exist" if you get an error to the console from the plugin when the game is started).

I think your saveTone method needs to clone this._tone, not just copy it over.
@Shaz Yup, that's my exact script. I know it's singling out that line but I don't know why.

I'm making these script calls from a common event (using YEP Button Common Events but I doubt that's relevant):
63HS6eN.png

After 300 frames, another common event runs with $gameScreen.loadTone(1);

I changed saveTone to
Code:
this._savedTone = this._tone.clone();
but it has not made a difference yet.
http://esprima.org/demo/validate.html
@Jonforum OK, that tool shows the same error but it doesn't help me understand why. :/

EDIT: Ok, the problem was that the bracket and semicolon were superfluous. I still would've appreciated more guidance!

I'm still getting errors but they're a little more specific now so I'll see if I can figure them out on my own for a bit.

EDIT 2: Everything works nicely now.
@Jonforum
EDIT: I still would've appreciated more guidance!

Your error message was "Unexpected Token (SaveTone.js:26) semi-colon ".

You had an extra semi-colon on line 26. (And an extra bracket on 28 that would have triggered another error once you got rid of the semi-colon).

Original thread: https://forums.rpgmakerweb.com/threads/why-does-this-code-snippet-have-an-unexpected-token-error.85091/