Your code seems to work, I copied and pasted it and it works perfectly.
The issue may be related to something else, like maybe an offset on the sprite based on its parent, something like that?
EDIT: actually, I changed the input part to use if Input.is_mouse_button_pressed(MOUSE_BUTTON_RIGHT) as your input condition did not work, but the issue is surely not related.
actually one more small issue and its weird It wont show up when I record it with OBS or my Phone. When making certain clicks the character gets stuck in a spammed state moving back and forth. Completely bizarre that it wont show up on video