I’m in need of something that when i click on, a number goes up and when i click on another object the number goes down. i have the script going but when i click on the object that makes the number go up it works, but when i click on the object that makes the number go down it doesn’t work and when i click on the object that makes the number go down the number goes down under 0 but does not go up.
Here’s the JavaScript:
var soundhover : AudioClip;
var beep : AudioClip;
var Negative : boolean = false;
var Positive : boolean = false;
var GunNumber : float = 0;
function OnMouseEnter(){
audio.PlayOneShot(soundhover);
}
function OnMouseUp()
{
audio.PlayOneShot(beep);
yield new WaitForSeconds(0.35);
if(Negative)
{
GunNumber -= 1;
}
if(Positive)
{
GunNumber += 1;
}
else
{
GunNumber += 1;
}
}
@script RequireComponent(AudioSource)