When Key is Pressed add one to variable

I Know my code is bad but, it would be really nice for an answer. So what i want is when KEY is pressed 1 is added to the score or also known as “money”

#pragma strict
var money : int;
var KEY : KeyCode;
function Start () {
money = 1;
}


function Update()
{
if (Input.GetKey(KEY));
{
money += 1;
Debug.Log("money$$$");
}
}

There are two main problems here, firstly your ‘if’ statement has a semi colon ( ; ) at the end of it which leads to an empty statement, and will NOT execute the if statement.

Second, Input.GetKey is for when you’re holding down the key, you want to use Input.GetKeyDown if you want to increase every time you press it.

Hope this helps!