GML Visual The Player does not Move to the Right

I followed the tutorial, and everything was going very well up to this point, where this fatal error occurred. I launch the game, the player walks without errors to the left, up and down, but when I click the arrow it does not go to the right. Can anyone help me solve it?
(The tutorial I'm following is in the book "Make Games Without coding in Gamemaker Studio 2"

This is the error:

FATAL ERROR in
action number 1
of Step Event0
for object obj_player:

Variable obj_player.X(100004, -2147483648) not set before reading it.
at gml_Object_obj_player_Step_0 (line 103) - X += 1;
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_obj_player_Step_0 (line 103)

The code is:

// GameMaker Language Preview (Read-Only)

// Assign Variable
is_moving = false;

// If Key Down
var l04E4A764_0;
l04E4A764_0 = keyboard_check(vk_down);
if (l04E4A764_0)
{
// Assign Variable
y += 1;
is_moving = true;
last_direction = "down";
}

// If Key Down
var l0BB6E334_0;
l0BB6E334_0 = keyboard_check(vk_up);
if (l0BB6E334_0)
{
// Assign Variable
y += -1;
is_moving = true;
last_direction = "up";
}

// If Key Down
var l1B33A435_0;
l1B33A435_0 = keyboard_check(vk_left);
if (l1B33A435_0)
{
// Assign Variable
x += -1;
is_moving = true;
last_direction = "left";
}

// If Key Down
var l6118B7D5_0;
l6118B7D5_0 = keyboard_check(vk_right);
if (l6118B7D5_0)
{
// Assign Variable
X += 1;
is_moving = true;
last_direction = "right";
}

// If Expression
if(is_moving==true && last_direction=="right")
{
// Execute Code
sprite_index=spr_p_move_right;
}

// If Expression
if(is_moving==true && last_direction=="left")
{
// Execute Code
sprite_index=spr_p_move_left;
}

// If Expression
if(is_moving==true && last_direction=="up")
{
// Execute Code

sprite_index=spr_p_move_up;
}

// If Expression
if(is_moving==true && last_direction=="down")
{
// Execute Code

sprite_index=spr_p_move_down;
}

// If Expression
if(is_moving==true && last_direction=="right")
{
// Execute Code
sprite_index=spr_p_idle_right;
}

// If Expression
if(is_moving==true && last_direction=="left")
{
// Execute Code
sprite_index=spr_p_idle_left;
}

// If Expression
if(is_moving==true && last_direction=="up")
{
// Execute Code
sprite_index=spr_p_idle_up;
}

// If Expression
if(is_moving==true && last_direction=="down")
{
// Execute Code
sprite_index=spr_p_idle_down;
}
 
Top