Make custom shiftlock without disabling vertical movement

So I’ve just finished making some admin commands, in particular I made a third person command for my first person only game. I disabled shiftlock and am trying to make a custom one that functions with this admin command, however I cannot move my character up and down since it’s being constantly moved left and right.

For example, my fly script is not working as intended, video example

If it’s not possible (which wouldn’t surprise me, Could I change the default keybind for shiftlock and also can I enable and disable it while the player is alive at any time?