MZ Parrallel common event script lags in Battles

I made a script that makes all party members have a shared MP bar and it works perfectly fine outside the battle but once I start one it starts lagging and I experience huge FPS drops.
Here's one of the fragments that causes the problem:

◆Script:window.v = $gameVariables._data
◆Script:v[1] = BattleManager.actor().index()
◆Script:v[2] = 0
◆Script:v[3] = 0
◆Script:v[4] = $gameParty.members()[0]._hp
◆If:Script:v[4] > 0
◆Script:v[2] += $gameParty.members()[0].mp
◆Script:v[3] += $gameParty.members()[0].mmp
◆
:End

Is there any way to fix it? I'm using waiting commands so it wouldn't refresh constantly.

Console Log gives me this:

Call Script failure, ReferenceError:
v[103] += $gameParty.members()[3].mmp
please show us screenshots of your event, because there are several things wrong with your description above:
1) the battlescreen version of the event interpreter doesn't have parallel processes at all, so they can't lag in default battlescreen
2) the event command "script" is sandboxed, which means that all locally defined variables get deleted on the end of the script box, which is why it's usually better not to use multiple script commands but to place multiple lines into a single script command

Original thread: https://forums.rpgmakerweb.com/threads/parrallel-common-event-script-lags-in-battles.141745/