How to collect sum of living party parameters?

Hello,

I am trying to create a total number that equals the sum of every living party members luk stat.

How can I make a script that will total up all living party members luk stat?
Hello, this will put the sum of alive members luck in variable x, if it's what you need:
Code:
let num = 0;
for (let i in $gameParty.aliveMembers()) {
  num += $gameParty.aliveMembers()[i].luk;
}
$gameVariables.setValue(x, num);

Original thread: https://forums.rpgmakerweb.com/threads/how-to-collect-sum-of-living-party-parameters.117602/