How to limit a camera's location in 1 axis

Hello there!
I’m making a Mario clone for a class in university using UE4 but I’m having trouble with the camera. Basically, I want it to update its transform so it doesn’t move backwards with the player (kind of like constantly clamping the y axis location). As of now, I have that, but the camera snaps back to the player when he starts moving forward again. Also, how could I go about saving the current position of the camera so that it starts following the player when he reaches that location.

Thank you for your time! And sorry if I’m unclear.

All right, found it! By attaching the camera to the player character and comparing the latter’s world position with the camera’s, I could achieve what I was looking for.

I wrote you this function to get the targets (Marios) relative screen position. Only works for left and right whereas the function returns 0 if the target is in the middle of the screen, 1 at the right and -1 at the left.