key is repeated 5 times.

I want every time the key is pressed but will add 1 add 5 ¿¿anyone knows why and how to fix this:??

var credit:int=0;

function Update () {

	if(Input.GetButtonDown("jugar")){			
           _root.credit ++;
}

}

result: credit=5; ???

Probably wrong because i’m a noob at unity :slight_smile:

var credit : int = 0;

function Update(){
     if(Input.GetButtonDown("Your_Key_Here")){
          credit += 1;
     }
}

Hope that works :wink:

Your script will only add 1 to credit. You probably have added this script 5 times to one or multiple objects in the scene.