Hello, So im trying to set up a script that will keep my number from going below 0 but i dont seem to understand how to do it. im trying to keep the Combat_Focus_Sanity_Total from becoming 0 even if the Combat_Focus_Sanity value goes below 0. Im sure my lack of understanding id biting me here. if someone could help me here and tell me what im doing wrong, i would appreciate it. Ill post the HTML below. <div class="Powers"> <h1>Simple Powers</h1> <input type="hidden" name="attr_Powers_Sanity_Reduction" value="[[(@{PsychicGift_Checkbox}+@{PsychicTraining_Checkbox}+@{AdvancePsychicTraining_Checkbox})]]" disabled="true"/> <div class="Heading"> <h4>&nbsp </h4> <h4>&nbsp </h4> <h4>Power</h4> <h4>Cast</h4> <h4>Range</h4> <h4>Sanity</h4> <h4>Duration</h4> <h4>Damage</h4> <h4>Save</h4> <h4>Type</h4> <h4>Effect</h4> </div> <div class="CombatFocus"> <input type="checkbox" name="attr_Combat_Focus" value="1"> <button type="roll" value="&{template:default} {{name=@{CharacterName} @{combat_focus}}} {{Damage=[[@{Combat_Focus_Damage}]]}} {{Crit=[[@{Combat_Focus_Damage}+[[(@{Combat_Focus_Dice}*@{Combat_Focus_Face})]]]]}} {{Sanity=@{Combat_Focus_Sanity}}} {{Duration=@{Combat_Focus_Duration}}} {{Save=@{Combat_Focus_Save} @{Combat_Focus_Type}}} {{Effect=For the duration when you hit a creature with an attack they must make a **WISDOM SAVING** throw or take an extra 1d8 psychic damage.}}"></button> <input type="text" name="attr_Combat_Focus_Name" class="power_name" value="Combat Focus" readonly /> <input type="text" name="attr_Combat_Focus_Cast" class="power_range" value="Bonus" readonly /> <input type="text" name="attr_Combat_Focus_Range" class="power_range" value="Self" readonly /> <input type="hidden" name="attr_Combat_Focus_Sanity_Base_Cost" value="2" disabled="true"/> <input type="text" name="attr_Combat_Focus_Sanity" value="round(@{Combat_Focus_Sanity_Base_Cost}-@{Powers_Sanity_Reduction})" disabled="true"/> <input type="text" name="attr_Combat_Focus_Sanity_Total" class="power_damage" readonly /> <input type="text" name="attr_Combat_Focus_Duration" class="power_duration" value="Concentration 1 Minute" readonly /> <input type="text" name="attr_Combat_Focus_Damage" class="power_damage" readonly /> <input type="text" name="attr_Combat_Focus_Save" class="power_Save" value="[[8+@{wis_mod}+@{proficiency}]]" disabled="true"/> <input type="text" name="attr_Combat_Focus_Type" class="power_Type" value="Wisdom" readonly /> <input type="text" name="attr_Combat_Focus_Effect" class="power_Effect" value="One Attacked Creature" readonly /> <input type="hidden" name="attr_Combat_Focus_Dice" readonly /> <input type="hidden" name="attr_Combat_Focus_Face" value="8" disabled="true"/> </div> </div> </span> </div> </div> </div> <script type="text/worker"> on('change:combat_focus_sanity', function() { getAttrs(['Combat_Focus_Sanity'], function(values) { const Combat_Focus_Sanity = parseInt(values.Combat_Focus_Sanity) || 2; let Combat_Focus_Sanity_Total = "2"; if (Combat_Focus_Sanity = 1) { Combat_Focus_Sanity_Total = 1; } else if(Combat_Focus_Sanity = 0) { Combat_Focus_Sanity_Total = 0; } else if(Combat_Focus_Sanity = -1) { Combat_Focus_Sanity_Total = 0; } else if(Combat_Focus_Sanity = -2) { Combat_Focus_Sanity_Total = 0; } else if(Combat_Focus_Sanity = -3) { Combat_Focus_Sanity_Total = 0; } setAttrs({ Combat_Focus_Sanity_Total: Combat_Focus_Sanity_Total }); }); }); </script>