Well it seems a bug but I am novice so I am not sure.
I have initialize a text variable for a object in Object menu:
After I type this code:
The code doesn’t paint the sprite of red because I am using a text variable. However if a I use a number variable it works. It works aswell if I initialize the text variable in code instead the “Object menu”