Simple Counting System

Hello :slight_smile: I am sorta new to code, and I’m trying to create a simple thing where there is a number counter for button pushing. The counter starts at 0, and every time you push the button on your keyboard (Right arrow key) the number goes up by one. Below is what I have so far, and it’s not working. Can anyone help??

using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using UnityEngine.SceneManagement;

public class Score : MonoBehaviour
	private int score = 0;
	public Text scoreText;
	void Update ()

		if (Input.GetKeyDown (KeyCode.RightArrow) )
		scoreText.text = "Taps: " + score.ToString();


The code is working. All you need to remember is to drag a Text Component reference onto the “scoreText” field in the inspector.
If you want to do this by code instead, and the Text component is on the same GameObject as this script then all you need to add is the following.

    void Awake()
        scoreText = GetComponent<Text>();