How to limit camera rotation when in animation

So i’m trying to make the player enter a tight-space for my horror game all that works fine however i want to make it so that when i’m in the tight-space my camera can only rotate up so far and rotate both sides so far, I’ve been at it for 2 days now and got no where with it.