Score HELP!

Hi people. I made a script for score in my game, but the score doesn’t change. Tracking the code:

static var pontuacao : int;
var TextoScore: GUIText;
var perSkin : GUISkin;
function Start () {

}


  function Update () {
  
  if (Input.GetKeyDown("e")) {
   pontuacao = pontuacao+1;
Destroy(gameObject);
          }
}

function OnGUI()
{
GUI.skin = perSkin;
TextoScore.text = "Score:"+pontuacao;

}

Up

Line 12 - pontuacao ++;
Or pontuacao += 1;

:slight_smile:

Not working…

Comment out/remove the destroy line and give it a try.

pontuacao = pontuacao+1;

is the same thing as:

pontuacao++;
pontuacao += 1;

I remove the destroy(gameobject); and working… but… Could someone make a C# script that increased the score, and a GUIText would be counting the scores but he only appeared when you pick up the page and then disappeared after a while, if not too much to ask, I would be very grateful!