Make camera only move on X and Y axis?

I’m trying to make the player’s camera move on only the X and Y axis. Here’s an example of what I’m trying to make: Example How can I achieve this?

Simply lock their camera on the Z axis with a loop. Shouldn’t be too bad to code.