Can somebody help fix my code!? [Noob]

Hi, I am trying to make an intro screen and i keep getting an error :frowning: can some body help me out?

public class AutoType : MonoBehaviour {
			
			public float letterPause = 0.2f;
			public AudioClip sound;
			
			string message;
			
			// Use this for initialization
			void Start () {
				message = guiText.text;
				guiText.text = "";
				StartCoroutine(TypeText ());
			}
			
			IEnumerator TypeText () {
				foreach (char letter in message.ToCharArray()) {
					guiText.text += letter;
					if (sound)
						audio.PlayOneShot (sound);
					yield return 0;
					yield return new WaitForSeconds (letterPause);
				}      

		function Start () {
			...................
				renderer.material.mainTexture.Play();
			Invoke("nextScene", 15);
		}
		
		function nextScene () {
			Application.LoadLevel("MainMenu");
		}
	}
		}

Ending bracket is missing. And that missing bracket is at the end of the script. You should delete that one.

 IEnumerator TypeText () {
              foreach (char letter in message.ToCharArray()) {
                  guiText.text += letter;
                  if (sound)
                     audio.PlayOneShot (sound);
                  yield return 0;
                  yield return new WaitForSeconds (letterPause);
              }
     }

Uhm you’re mixing C# and Unityscript syntax here. Since it’s a c# script everything needs to be C#. You also have “two” Start methods, one written in C# the other in Unityscript. You have to merge them into one. Next thing is the Texture class doesn’t have a Play method, only the MovieTexture, so you need to cast it to a MovieTexture (assuming you’re using a MovieTexture of course).

something like this:

public class AutoType : MonoBehaviour
{     
    public float letterPause = 0.2f;
    public AudioClip sound;
     
    string message;
     
    void Start()
    {
        message = guiText.text;
        guiText.text = "";
        StartCoroutine(TypeText ());
        Invoke("nextScene", 15);
        var movie = renderer.material.mainTexture as MovieTexture;
        if (movie != null)
            movie.Play();
    }
     
    IEnumerator TypeText ()
    {
        foreach (char letter in message.ToCharArray())
        {
            guiText.text += letter;
            if (sound)
                audio.PlayOneShot (sound);
            yield return 0;
            yield return new WaitForSeconds (letterPause);
        }
    }
    
    void nextScene()
    {
        Application.LoadLevel("MainMenu");
    }
}

renderer.material.mainTexture.Play();

Never seen the Play function in a maintexture