Reference error - not defined

I'm trying to use a script that was done a while ago but I'm getting a reference error with it.
The script is supposed to count how many times a skill has been used in battle and keep a record of it.
Theres no errors in the battle itself, only when referencing from an event.

The script is
Code:
//=============================================================================
//LudoSkillCount.js
//=============================================================================

/*:
 * @plugindesc Counts the amount of times a skill has been used in a single battle, and over the course of the game.
 * @author Alessio De Santis
 *
 *
 * @help
 * Access the values by using script commands.
 * $skillCount[skillId].battle for the amounts of times used in a battle (value is saved until next battle)
 * $skillCount[skillId].total for the total amounts of times used in all battles.
 */  


 //-----------------------------------------------------------------------------

$skillCount = [];


 Scene_Battle.prototype.start = function() {
    Scene_Base.prototype.start.call(this);
    this.startFadeIn(this.fadeSpeed(), false);
    BattleManager.playBattleBgm();
    BattleManager.startBattle();
 };



BattleManager.startBattle = function() {
    this._phase = 'start';
   

    $gameSystem.onBattleStart();
    $gameParty.onBattleStart();
    $gameTroop.onBattleStart();
    this.displayStartMessages();
};

BattleManager.startAction = function() {
    var subject = this._subject;
    var action = subject.currentAction();
    var targets = action.makeTargets();
    this._phase = 'action';
    this._action = action;
    this._targets = targets;
    subject.useItem(action.item());
   
    this.increment(action.item().id);

    this._action.applyGlobal();
    this.refreshStatus();
    this._logWindow.startAction(subject, action, targets);
};

Scene_Title.prototype.create = function() {
    Scene_Base.prototype.create.call(this);
    this.createBackground();
    this.createForeground();
    this.createWindowLayer();
    this.createCommandWindow();

    this.initSC();
};

BattleManager.increment = function(id) {
    if(id != 0){
        $skillCount[id-1].battle++;
        $skillCount[id-1].total++;
    }
}

BattleManager.resetSC = function() {
    for(i of $skillCount){
        i.battle = 0;
    }
}

Scene_Title.prototype.initSC = function(){
    var temp = $dataSkills;
    for(i of temp){
        for(j in i){
            if (j == "name") {
                for(k of $skillCount) {
                    if(k.name == i[j]){
                        return console.log($skillCount);
                    }
                }
                $skillCount.push({
                    name : i[j],
                    battle : 0,
                    total : 0,
                });
            }
        }
       
    }

In the event, I'm simply trying to assign to a variable and print the value.
Variable 1 = $skillCount[5].total
Value is: \v[1]
How many skills does your game have?
it would help to get a screenshot of the console output of the error you're getting, because that error can have dozens of different causes.
Play the game until you get the error, then press F8 and give us a screenshot of the console output.
Note: make sure that it's the console because some browsers open the developer functions on the elements instead of the console, and we need the console output.
As an aside, I don't see anything in there that supports the claim that it keeps track over the entire game. There is nothing that saves the figures or loads them, and in fact from what I can tell, as soon as you return to the title screen, everything will be reset to 0.

If you want to track the number of times skills were used over the entire game, you're going to need a different plugin, or a rewrite of this one.

Original thread: https://forums.rpgmakerweb.com/threads/reference-error-not-defined.106769/