[SOLVED] How come I keep getting the message, Invalid Value?

0 favourites
  • 7 posts
  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Here is the screenshot izicial:

  • 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.

  • Thank you very much!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)