How to create a leaning function

I am currently trying to develop a first person horror demo, and I want to add a lean function to it. I have looked up videos on how to do so, yet they are outdated and my character does not seem to be able to move after leaning and returning to the original camera view. Does anybody have any tips or advice?