Yield WaitForSeconds doesn't work

Hi there :slight_smile:
I’m creating and testing subtitles in my game. I have an empty object called “SubtitlesObj”, with a GUIText component on it (those are the subtitles). I have this script attached to it:

public var Subtitles : GameObject;
public var Subs : GUIText = Subtitles.GetComponent("GUIText");

function Update () {
	
		if(Input.GetKeyDown ("space")){
		 	Debug.Log("jumped");
		 	SubsSay("Thump!!","2");
		}
		
}

function SubsSay(SubsText,SubsDuration){
	Subs.text = SubsText;
	yield WaitForSeconds(SubsDuration);
	Subs.text = "-nothing-";
}

But it doesn’t work. I want the subtitles to say “Thump!!” when player presses space, then wait for 2 seconds and change the subtitle to “-nothing-” (for testing purposes). However, the yield command doesn’t seem to work. When I remove it, the subtitles change to “-nothing-” when space is pressed. But when the yield command is there, it gives me an error and the “Thump!!” subtitle stays there forever. Can you help me with that please? Thank you!

SubsSay(“Thump!!”,“2”);

“2” should be an integer/float.

//change it to this
 SubsSay("Thump!!",2);