MZ TypeError Cannot read property 'currentExp' of undefined

First off, thank you for reading this. I hope should a solution be found, this helps other people as well.
I am using the HUD Maker Ultra Pro plugin for MZ and the goal was to make experience bars for the party.

I found I needed to use the custom code feature, shown here in a screenshot:

customcodewindow.png


So, I looked at the "RPG Maker MZ Script Call Reference" sheet found here:
RPG Maker MZ Script Call Reference

I assumed, because in the "Script Call Reference Sheet" the syntax was:
JavaScript:
$gameParty.members()[n].currentExp()

... that [n] would be replaced with the number of the party member.

For the Main Actor, Hero 1, I ended up using the following for the start of the gauge value:
JavaScript:
return $gameParty.members()[0].currentExp() - $gameParty.members()[0].currentLevelExp();

... and the following for the "maximum" of the gauge value:
JavaScript:
return $gameParty.members()[0].nextLevelExp() - $gameParty.members()[0].currentLevelExp();

When playtesting everything worked fine to my knowledge.
So, I began adding the party HUD and added the second hero, Hero 2.

For the start of the gauge I used:
JavaScript:
return $gameParty.members()[1].currentExp() - $gameParty.members()[1].currentLevelExp();

... and the following for the "maximum" of the gauge value:
JavaScript:
return $gameParty.members()[1].nextLevelExp() - $gameParty.members()[1].currentLevelExp();

I checked the console, and found via "typeof" it was indeed, "undefined."

So, what I think is going on here is, the exp isn't being set for party member 2, when I try to start a new game or load a save.
Is there a way I can define this "undefined" "currentExp" - I apologize I am just starting to learn JavaScript so I will likely need some guidance.

Sorry for the long post, I wanted to be as clear as possible.
Thank you, in advance.
You're missing the parentheses. You have them in your first quote from the script call reference sheet, but you are missing them from a ton of places in your actual code.

That causes the code interpreter to look for a variable named that, rather than a function, and there is no variable with that name defined in your actors.
You're missing the parentheses. You have them in your first quote from the script call reference sheet, but you are missing them from a ton of places in your actual code.

That causes the code interpreter to look for a variable named that, rather than a function, and there is no variable with that name defined in your actors.
I'll check that now.

Edit: It was a typo on the forum post, so sorry. Thank you for pointing that out. Error persists.

Original thread: https://forums.rpgmakerweb.com/threads/typeerror-cannot-read-property-currentexp-of-undefined.153988/