Scoring problems.

I deleted all of the scripts with the addscore. however, it still will not add the score when I hit my enemies.
This script is attached to the player.

var score : int;

private var enemyHit: boolean = false;



function OnGUI () {
if(enemyHit==true)
{
score +=5;
}
GUI.Label(Rect(10, 10, 600, 500), "Score:" + score);
}

This is the Enemy Script

var score = 5;

function AddScore()
{
score +=5;
}

@popmog78
From the looks of it, there is no real calling of the enemy script. Look up GetComponent, Broadcast Message, and Send Message when it comes to getting/using scripts from other objects.

-S

As well as the enemy script method AddScore never being called, the enemyHit boolean in your player script is always returning false at this point; so there is no increase of the score on player side either. You are also keeping two separate score variables for the player and enemy, so if you increase the score on the enemy side, it will not affect the player script. As Sevisin initially suggested take a look at the above methods, or something that is already made for you along the lines of CShareMessenger Extended

Thanks Alex. I sent an email with both of my scripts

Popmog78, I apologize as I have been on holiday and out of town for the past two days. What I have done for you, is I have thrown together a very quick and dirty example showing a working example with adding to the score through the use of a messaging system. You can download and look over the example project HERE. Let me know if this assists you with your issue and gets things halfway towards what you were shooting for.