How do I resolve script issues with Unity, I am currently getting a "Unknown identifer" & Non static Acess member issues.

Currently i cant progress with my scripts using Java for unity 5 development, as the following two issues are appearing:

Assets/Scripts/CoinSystem.js(18,4): BCE0005: Unknown identifier: ‘elseif’.

BCE020: Assets/Scripts/CoinCollecter.js(3,16): BCE0020: An instance of type ‘CoinSystem’ is required to access non static member ‘coinscollect’.

I have attached a copy of the scripts in question:

Which is trying to achieve three goals

  1. Create three GUI labels (one to display collected coins), one to display coins remaining and the other is to tirgger a game over screen or text to occur.
  2. add the score of the coin by a value (ie. adding to a score when a coin is picked up.
  3. To make the coins add to the coins collected (ie when collected coins goes to 1).

thanks for any help or any information that may help to resolve the problem :).

That code is a bit messed up. Try this and let me know :

#pragma strict

// These are the variables used to make the game work. 
var coinscollect : int = 0;
var TotalScore : int = 0;
var CoinScoreValue : int = 1;
var startTimer : int = 50;
var gameOver : boolean = false;
var coinsleft : int = 0;
var timer : float;

//static CoinSystem = new CoinSystem();
//name.coincollect(); 

function Start(){
coinsleft = GameObject.FindGameObjectsWithTag("Collectible").Length;
}

function startTimer1 () { 
	
	timer = Time.time; 
		
	if (startTimer > 0){
		startTimer -= Time.deltaTime; 
	}
	else if (startTimer <= 0){ 
		gameOver = true; 
	}
}

function OnGUI () { 
	
		GUI.Label (new Rect (10, 10, 90, 40), ("Coins Collected: " + coinscollect)); 
		GUI.Label (new Rect (10, 120, 100, 50), ("Coins Remaining: " + coinsleft.ToString));
	if(gameOver){
		GUI.Label (new Rect (10, 20, 90, 40), ("Game Over!" + startTimer)); 
	}
}

function Score1() {
	CoinScoreValue += TotalScore;
	coinscollect++;
   }