How to lerp rotate the gun to the opposite of ur mouses X position and clamp it

i wanna lerp the position of the gun to the position of the gun + the mouse x position but i dont want the gun to rotate more than -30 and 30 on the y axis… pls help i have no idea how to even start
i just want the gun to not always be stuck in its place and have more movement so i decided to do this…
also like in the game “karlson” by danidevstuff

alright i solved it lol