I read somewhere that you shouldn’t check is_on_floor() before move_and_slide(). The move_and_slide() function sets the value of this method so it’s important not to check it before, or you’ll be getting the value from the previous frame.
Does that make a difference?