make sure youre comparing the vector length, since that will tell you the total positive speed of all its axes combined, wheter in a positive or negative direction.
A better way to do it is with Input actions. That way you do not have logic on the tick event. I map an inputAxis to the W key and I map W to the “ForwardKey” input action. Just have to remember if you or the player remaps keys you have to change it on both.
In that case you will want to check more things, like whether the character is currently falling (airborne) and if they have any inputs higher than 0 (are trying to move themselves instead of being moved by outside forces)