I’ll do a guessing of what is happening but without the entire code is impossible to help you correctly, if you’re checking this inside _input
/_unhandled_input
that will not work because this functions is called only when a input is received (press a key, release a key, move the mouse, etc) so if this is the case you should check that inside _physics_process
callback instead.
Always show the entire code, otherwise will be hard to help.