How come I keep getting the message, Invalid Value? I have a textbox and its type is number and it also has an instance variable. I want to set the numbers entered in the textbox as the instance variable value but each time I try to I get the message: Invalid value for "Value". You can not set a string to the number variable '(name of variable)' - use int() or float() around the expression to convert. I set the code to: Set Value for (Variable Name) to (object_name).Text but that does not work. Also, I do not want to change the type of the textbox because that would screw up my game. Help would be greatly appreciated!
I'm not entirely sure what you are trying to say.
Upload a screen shot of what is happening wrong and your code and perhaps we can get a better idea.
Here is the screenshot izicial:
Develop games in your browser. Powerful, performant & highly capable.
Ok, that's what I though you were doing.
You have to change the variable type to text. It can't be number. Doesn't matter what else you have to change because of it but if you want it to work that way then it must be a text variable and not number.
izicial I understand that, thank you but I really want to keep the type number because this textbox is supposed to allow players to enter their amount of money and so I don't want them to be able to enter letters.
Change textbox_income.text to a text variable then use int(textbox_income.text) to convert the string to an integer. Save it in a different variable if you want to then avoid having to repeatedly do the conversion.
Collumdium Thank you very much!