Changing variables from another script with a cached local variable

Hey, this really is my problem area as people will see from my history ^^’
My attack script deals damage to an enemy through this “PlayerAttack” script:

			if(distance < 2.3F){
				if(direction > 0.25) {
			EnemyHealth eh = (EnemyHealth)target.GetComponent("EnemyHealth");
			eh.AdjustCurrentHealth(-10);
		}
	}

Which works fine but the way I get the ‘target’ variable is local in that script, with it changing between gameObjects in an array when I press E but in my arrow script I want to be able to deal damage on arrow collide, how would I go about calling the ‘target’ variable from the attack script and caching it within my arrow script, perhaps on every press of E?
Many thanks.

Well you just pass var to arrow object after you instantiate an arrow and mede it to be some local var.

lets asume you allready have this:

private var Target : GameObject = SomeGameObjectHere;

now

var Arrow : GameObject = GameObject.Instantiate(Some vars here);
Arrow.GetComponent(HitScript or something).Target = Target;

BTW its a good idea to disable HitScript in prefab and enable it only after all vars have been passed. So no null var will get in your way.