GameMaker [SOLVED] DoAdd :: Execution Error at draw+text

K

Kleber_Ferreira

Guest
The error below occurs when I run the game. I want to draw the score to the screen with the word Score before it. Drawing just the score variable to the screen shows no problem, adding the "Score: " string before it is causing the trouble and I don't know what's up.

FATAL ERROR in
action number 1
of Draw Event
for object obj_joystick:

DoAdd :: Execution Error
at gml_Object_obj_joystick_Draw_0 (line 3) - draw_text(scoreX, scoreY, "Score: " + global.points);

I've been using GMS for months and this never happened. I have always drawn strings + variables to the screen.
 
Change this:
Code:
draw_text(scoreX, scoreY, "Score: " + global.points);
to this:
Code:
draw_text(scoreX, scoreY, "Score: " + string(global.points));
Because the global.points is a number it is attempting to use addition (as in maths) to add the value of the global.points to a non-number "Score: ".
 
Top