Your code would work in the 8.1 engines, but not the studio engines, which I assume you're using. For some reason changing the player's image_xscale in studio messes up the physics. So instead, the engines store that xscale variable somewhere else, and manually draw the player with that xscale. In Yoyo's engine the variable is "player.xScale", and in previous versions it was "global.player_xscale". So yeah, your first attempt is the right idea, just use the player's special xscale variable instead.