Scoring system not working.

I’ve been trying to make a capital guessing game and am stuck on scoring.

There are four buttons, one of which is tagged “Correct Answer” and the rest are tagged “Wrong Answer”.

Here’s the script attached to the buttons:

public class ButtonController : MonoBehaviour
{
	public Score score;
	public SetUI setUI;
	public int correctValue = 10;
	public int wrongValue = 5;
	public Button button;


	void AnswerCheck ()
	{
		if (button.tag == "Correct Answer") 
		{
			score.currentScore += correctValue;
		} 
		else if (button.tag == "Wrong Answer")
		{
			score.currentScore -= 5;
		}
	}

	void OnClick ()
	{
		AnswerCheck ();
	}		
}

Here’s the score script referenced:

public class Score : MonoBehaviour
{
	public Text scoreText;
	public int currentScore = 0;

	void Start ()
	{
		scoreText.text = "Score: " + currentScore;
	}

	void Update ()
	{
		Debug.Log (currentScore);
	}
}

Everything is tagged correctly and I don’t know what the problem is. I’ve tried to use bool’s and the Update function, but that made things worse.

Hmmm to be honest i don’t see what’s wrong with your code right now, however i can tell you how i proceeded to make mine in an arcade game. The scoring systems works as of now. I put the score as private inside the “Score” script, and simply call an Addscore function which is inside the “Score” script from the targets that gets destroyed:

public GUIText scoreText;
private int score;

public void AddScore(int ScoreValue)
    {
        score += ScoreValue;
        UpdateScore();
    }

    private void UpdateScore()
    {
        scoreText.text = "Score:" + score;
    }