Using Pause and sound on/off in Toggle

I have this code and would like to add an audio on/off and pause to it but i keep getting errors, please advice.

@script ExecuteInEditMode()

private var toggleState1 : boolean = false;

private var toggleState2 : boolean = false;

function OnGUI() {

toggleState1 = GUI.Toggle(Rect((Screen.width - 800)/2, 20, 150, 20), toggleState1, "Sound on/off");

toggleState2 = GUI.Toggle(Rect((Screen.width - 800)/2, 40, 150, 20), toggleState2, "Pause");

}

this is my pause button code

if(Input.GetButtonUp("Pause")){
   if(Time.timeScale > 0)
	Time.timeScale = 0;
   else
	Time.timeScale = 1;
   }

and you can use
audio.mute = true/false
to toggle music

Use AudioListener.pause to pause all sounds in your game - audio.mute only mutes the AudioSource of the script owner object.

@script ExecuteInEditMode()

private var toggleState1 : boolean = false;
private var toggleState2 : boolean = false;

function OnGUI() {
  toggleState1 = GUI.Toggle(Rect((Screen.width - 800)/2, 20, 150, 20), toggleState1, "Sound on/off");
  AudioListener.pause = toggleState1;
  toggleState2 = GUI.Toggle(Rect((Screen.width - 800)/2, 40, 150, 20), toggleState2, "Pause");
  Time.timeScale = toggleState2? 0 : 1;
}