SOLVED: Trying to get maximum Luck stat of party

I'm sure there's a relatively quick way to use a script call to get the maximum value of the Luck ($gameActors.actor(actorID).param(7)) statistic of all party members. But I keep getting a crash ("TypeError: Cannot read property 'param' of null") when doing this:

Code:
◆Script:for(var i=0,actor=0,maxLK=0; i<$gameParty.size(); i++) {
:      : actor=$gameParty.members();
:      : maxLK=Math.max(maxLK,$gameActors.actor(actor).param(7));
:      :}
:      :$gameVariables.setValue(2,maxLK);

to put it into variable 2. I've already discovered that you have to use gameParty.size() as .length returns 0 even with 6 in the party, and .size() is correct.
And tried commenting out the "maxLK=" line and getting last actor value with .setValue(2,actor) but that's showing "[object Object]"!
Try this:
Code:
var maxLK = 0;
for (a = 0; a < $gameParty.size(); a++) {
maxLK += $gameParty.members()[a].param(7);
};
$gameVariables.setValue(2, maxLK);
The "$gameParty.members()[a].param(7)" (it's [ i ] in my script but that triggers italics here in the forum) gets me what I wanted, thanks! Annoying that I couldn't access the actor value and use the methods that I'm used to from other scripts, but I'll leave it for now.

SOLVED
Spoiler: complete working code
Code:
  ◆Control Variables:#0001 RandomPercent = Random 1..100
  ◆Script:for(var i=0, maxLK=0; i < $gameParty.size(); i++) {
  :      : maxLK = Math.max(maxLK, $gameParty.members()[i].param(7) );
  :      :}
  :      :$gameVariables.setValue(2, maxLK);
  ◆If:RandomPercent ≤ temp
    ◆Control Switches:#0019 thisTrapDisarmed = ON
    ◆Exit Event Processing
    ◆
  :End
where my variable 2 is named "temp", and param(7) is Luck

Original thread: https://forums.rpgmakerweb.com/threads/solved-trying-to-get-maximum-luck-stat-of-party.79532/