GUI help! I have no idea why my code this isn't working!

var clickSound : AudioClip;

function OnGUI(){
if(GUI.Button(Rect(25, 370, 150, 25), GUIContent ("Singleplayer", "SingleTool"))){
 if(GUI.tooltip == "SingleTool"){
   audio.PlayOneShot (clickSound);
      }
   }
}

I think it was because I did the code wrong, yes?

there were no errors everything was fine, I attached my sound to the var and everything but it did not play the sound when I hovered over the gui button!

Have you tried clicking on the button. The way you have the code set up would only play the sound when you click it, since you have the code to play the audio inside the if(GUI.Button…) statement. Try this if you want the sound to play when you hover over the button:

var clickSound : AudioClip;

function OnGUI(){
GUI.Button(Rect(25, 370, 150, 25), GUIContent (“Singleplayer”, “SingleTool”))

if(GUI.tooltip == “SingleTool”){
audio.PlayOneShot (clickSound);
}
}

Note: I am new to Unity so I may be completely wrong.