I want help with code

I want to know that how can I check that what is the value of text in my label.
For eg:
If there is a Label, Label2, a Button and a Button2 as children of Node 2d. The code of the Node 2d says whenever the Button is pressed, a random value from 1 to 3 will be put into the label. And when the Button2 is pressed, the text in the Label is checked and according to the value present in it (i.e. 1, 2 or 3), the text in Label2 is changed to A, B or C.

But I am not able to code for the Button2 being pressed, since I don’t know how to check the text in the Label and compare it.
Please help soon.

Please only use the Forum Feedback category for feedback about this forum, not for questions. I have moved your post to the Help category.


There’s a variable called text that you can get by accessing it like any property. Then just check if it is 1 2 or 3 and set the other labels text accordingly. I am pretty sure text is a string so you might want to convert it to a int or float for checking.