Help Fix Camera movment

I have a system of fixed cameras through which the Character moves. What I want to do is to preserve the key and direction that was being pressed before changing the camera to the new one, and if the key is released, it should adjust again with the new keys.