Setting a variable to a variable from another script

Im trying to set a game object variable to the same game object variable from another script.

so script one has:

var object : GameObject;

and script two has:

var target : GameObject;

how do I set script two’s target to script one’s object using GetComponent?

Here you go!

var target : GameObject;
var script1Obj : GameObject;
private var script1 : Script1;

function Start () {

	script1 = script1Obj.GetComponent(Script1);
	target = script1.object;

}

Set script1Obj to the gameObject on which Script1 is attached, and set make sure to change all references to ‘Script1’ within the script to whatever the actual name of that script is.

Hope that helps, Klep