communication with other gameobjects for powerup

hi everybody,i have a problem.I am creating a powerup that when you reach the score 30 the powerup is actived and it goes to change the movement. but the powerup script and the script of the movement are’nt in the same gameobject.
I tried with this code but doesnt work:

movimento move;
scorePlayer scrPl;
public int scorePower;

void Start () {
	move=GetComponent<movimento>();
	scrPl = GetComponent<scorePlayer>();
	move = GetComponent<movimento>();// class movement
	scorePower = scrPl.score;
}

// Update is called once per frame
void Update()
{
	if (scrPl.score >= 20)
	{
		move.MOVE();
	}

and this is the class movement:

powerUp pwrp;
public int scoreInt;
public bool MoveIt = false;

// Use this for initialization
void Start()
{
pwrp = GetComponent<powerUp>();

}

public void MOVE()
{
	if (pwrp.scorePower >= 20)
	{
		MoveIt = true;
	}
}

void Update()
{
	if (MoveIt)
	{
		if (Input.GetKey(KeyCode.LeftArrow))
		{
			transform.position = new Vector3(-30 * Time.deltaTime, 0, 0);
		}
		if (Input.GetKey(KeyCode.RightArrow))
		{
			transform.position += new Vector3(30 * Time.deltaTime, 0, 0);
		}

	}
}

what went wrong???
thanks in advance :slight_smile:

Hmm, I’m not sure how you’re linking the scripts together from looking at your code, but you can try using the Advanced CSharp Messenger scripts available over at the unifycommunity wiki:

http://wiki.unity3d.com/index.php/Advanced_CSharp_Messenger

I use it often in projects. It’s an extremely handy way to help scripts interact that have no direct references to each other.