BCE0051: Operator '+' cannot be used with a left hand side of type 'Object' and a right hand side of type 'int'.

I dunno what I’ve done wrong. Here’s all scripts I use I only get an error in the first one

#pragma strict

var ScoreCounter;
var Health : float;
var ScoreToGive : int = 100;

function Start () {
ScoreCounter = GameObject.Find("Score").GetComponent(Score).Score;
Health = gameObject.GetComponent(EnemyHealth).Health;
}

function Update ()
{
	if(Health <= 0)
	{
	ScoreCounter += ScoreToGive;
	}
}

#pragma strict

var Score : int = 0;
var curScore : int = 0;
var ScoreGUI : GUIText;

function Update () {
	if (Score > curScore)
	{
	curScore +=1 * Time.time;
	}
	if (curScore > Score)
	{
	curScore = Score;
	}
	
	ScoreGUI.text = curScore.ToString();
}

My answer didn’t seem to register, so I’ll give it another try…

Change “var ScoreCounter;” to “var ScoreCounter : int;”. That should get it to work.

I havent tested this:

Your script thinks ScoreCounter is an object, since you have not defined it as anything. I assume you want to change an int named Score in the object with the tag “Score”. Easiest way I think is to remove the .Score from the getcomponent. Now you only acces the script. Then do ScoreCounter.Score += ScoreToGive.

So it will look something like:

 var ScoreCounter;
 var Health : float;
 var ScoreToGive : int = 100;
 
 function Start () {
 ScoreCounter = GameObject.Find("Score").GetComponent(Score);
 Health = gameObject.GetComponent(EnemyHealth).Health;
 }
 
 function Update()    {
     if(Health <= 0)
     ScoreCounter.Score += ScoreToGive;
 }