This script doesn’t make much sense! Why OnTriggerEnter? Why Destroy(gameObject)?
If you want to select all objects tagged “upkeepWater” inside a 100m range, get an array with all “upkeepWater” objects at Start (Awake or code outside any function may be executed when not all objects were created yet!). When needed, call the function SetVariables() below to select objects inside the range and increment their waterUpkeep variables:
private var randomCreate = 0.0;
var upkeepWaterObjects: GameObject[];
function Start(){ // get all objects tagged "upkeepWater" in the array:
upkeepWaterObjects = GameObject.FindGameObjectsWithTag ("upkeepWater");
}
// call this function to add 5 to the variable waterUpkeep in each object
// tagged "upkeepWater" that's at 100m or less of this object:
function SetVariables(){
for (var upkeep in upkeepWaterObjects){
if (Vector3.Distance(upkeep.transform.position, transform.position)< 100){
// get the script (replace ScriptName with the actual script name!):
var other2 = upkeep.GetComponent(ScriptName);
other2.waterUpkeep +=5;
}
}
}