//Attack multiplier for stuff like Astra if (obj.attack_multiplier != 0 && combat != false) { let mult = obj.attack_multiplier; if (DoubledB) { //needs to be adjusted to be user-agnostic mult -= 1; //check if user has doubled yet if (TripledB) { mult -= 1; //tripled? if (QuadedB) { mult -= 1; //quadrupled? } } } for (i = 0; i < mult; i++) { if (randomInteger(100) < (MHitU - MAvoE)) { Chatstr += '<p style = "margin-bottom: 0px;">' + UName + " hits for " + Dmg_U + " damage! </p>"; //Check if attack crits if (randomInteger(100) < (MCritU - MDdgE)) { Dmg_U *= 3; Chatstr += '<p style = "margin-bottom: 0px;">' + UName + " crits for " + Dmg_U + " damage! </p>"; hasCritB = true; } Temp_HPE -= Dmg_U; DmgtotalA += Dmg_U; CurrHPE.set("current", Temp_HPE); log(CurrHPE); log(CurrHPU); //Nobody gets any WEXP for now //DecUsesB(); log("Decreased weapon uses!"); if (hasCritB) { Dmg_U /= 3; hasCritB = false; } } else { Chatstr += '<p style = "margin-bottom: 0px;">' + UName + " misses! </p>"; } } DoubleB = false; //likewise, needs to be adjusted to be user-agnostic DisableatkB = true; if (user == "attacker"){ //here is where the problem is //HPB = Temp_HPE; } else { HPA = Temp_HPE } } The full script can be found here . So I keep trying to change this one global variable named HPB (representing the numerical HP value of the secondary character), but whenever I attempt to do so within the Skill() function, the console throws me an infinite loop error. Which is odd, because HPB isn't linked whatsoever to any loops at all in the script- I checked. Any help would be appreciated, because I'm honestly stumped. (For context- I decided to globalize the Skill() function as opposed to having 4 slightly different versions in different scripts, but as a result, I had to globalize some variables that used to be within the scope of the localized versions, HPB being one of them.)