What's wrong with this string list code?

Im trying to change the context of a Text UI Element by cycling through a string index each time the player hits space, using this:

code

Supposedly, it should change the text two times and stop at the last one, waiting for C to change the whole scene.

Right now, it’s not even changing. It keeps rewriting the first string “text1” over and over. I can see “text2” trying to appear when I press space, but it goes right back to the first one.

What’s is happening?

The variable index gets reset to 0 each time state_hall_1() is called. Try declaring it outside the function, and see if that works better :wink: