Code Not Working

The code: change (Variable) by _______ is not working for me

Hi @Toh_Yu_Kai,

Could you please describe what you are trying to do and share your CoSpace so I could take a look at it?

I am trying to do a “Boss Fight” type.

1 Like

Hi @Toh_Yu_Kai,

What are you using the variable for? Can you post an image of your code? (See how at https://www.youtube.com/watch?v=Jo27jYQj4XM )

Regards,
Geoff @ TechLeap

Hi @Toh_Yu_Kai,

By default, the variable accepts a text string datatype - both letters, numbers, and punctuation - that’s why you see the double-quotes " 100 ". However, if you want to use the change variable by number block, you need to set your initial variable to a number datatype. This is available in Data > Values and looks like this:

number-value

Drag the number value CoBlock into the value space in your variable and change the value so it looks like this:

Now your change variable by number blocks should work.

Hope that helps! Let me know if you have any further questions.

Geoff @ TechLeap

PS: If this solves your problem, please mark as Solved.

Sorry. I tried it out but it still does not work

Sorry to hear that! If you can share your project and make it remixable, I can have a look at what might be the issue.

Ngaa mihi,
Geoff @ TechLeap