can some one please tell my why this dosent work i am trying to make it so if i have enuf cash i can buy something(diferent weapons wich take place as scripts) it then disables one weapon and enables the other and takes away the amout of money it costs but it dosent work this is the script and it ses i cant have “-=” for playerprefs or sumthing like that hear is the script(i dont no how to format in this sorry):::::
function OnGUI ()
{
if (GUI.Button(Rect(10,10,50,30),"Click"))
{
if (PlayerPrefs.GetInt("Cash") == 100)
{
gameObject.GetComponent("ScriptName").enabled = true;
gameObject.GetComponent("ScriptName2").enabled = false;
PlayerPrefs.SetInt("Cash") -= 100;
}
if (PlayerPrefs.GetInt("Cash") == 100)
{
gameObject.GetComponent("ScriptName").enabled = false;
gameObject.GetComponent("ScriptName2").enabled = true;
PlayerPrefs.SetInt("Cash") -= 100;
}
//print(wep2);
}
}