How to make the enemy follow the player only on x axis

Could you only apply the .x of your vectors?

linear_velocity.x = direction.x * speed

Make sure to paste scripts instead of screenshots