setText problems

#1

i’m using this on text (not some rectangle or whatever) and it says this in the image.
also, why is it on line -1? and how do global variables work? I think global vars should be put in the list of preset functions. that was completely random, but it’s part of my project.

1 Like

#2

It looks as though you converted your text object into either a clip, or a button.
If a text object is converted, you can no longer edit it.

You’ll need to break it apart back into a normal text object, and use the
setText function from another object’s script.

0 Likes

#3

Or you can use clipName.textName.setText("hello"). Replace clipName with the actual name of the Clip that is wrapping the text object.

I used this method so I could move text objects around, since setting variables like “x” did not work on text objects, only on Clips. (I don’t know if it’s still that way, though)

1 Like

#4

Never knew about that! :open_mouth:

0 Likes

#5

They don’t work for me, it says “cannot read property ‘setText’ of undefined (line 42)” (my line 42 is just a “}”, it’s actually on line 44) this is what I wrote:
score.textName.setText(scoreLeft + " - " + scoreRight);
score (the text), scoreLeft, and scoreRight (both integers) are all defined. is it because I can’t have numeric values in a string unless it’s concatenated? if so, how would I do it?

1 Like

#6

OHHHHH I FOUND THE SOLUTION
textName is supposed to be changed out to the name of the text

0 Likes