Here is an example of a fully-functioning first person script:
The important part to fix your issue is that you don’t move the direction your camera is facing, but rather keep a Transform that does not angle up or down, only tracks the ground normal, and use that to move.