set another scripts variable

Hi I’m just wondering how would I change a scripts variable from another script?

for example:

script1

var target : GameObject;

script2

var victim : GameObject;

how do I set the victim game object to the same game object as script1’s target?

script1

var target : GameObject;

function InitProjectile()
{
   var newProjectile : Projectile = Instantiate(porjectilePrefab,position,rotation);
   var otherScript : newProjectile.GetComponenet.<script2>();
   target = otherScript.victim;
}

you should of course update porjectilePrefab, position and rotation to the settings you are using…

This is C#. I don’t know how to convert a var from JS to something else in C#… So i converted it in string. I may say wrong

Script 1 :

using UnityEngine;
using System.Collections;

public class script_one : MonoBehaviour {
static string target = GameObject;
}

And script 2 :

using UnityEngine;
using System.Collections;

public class script_two : MonoBehaviour {
void Update(){
    if(.......){
        script_one.target = ...;
    }
}
}

If you can’t modify the string target, that is because you must put it in public static string