you could try something like this.
at the start of the script set x_max=x
then in the update part you put this
if x > x_max
then xmax =x
then link the camera to xmax not x
that way x_max contains only positive and greater values of x, eg when x declines the camera stays at x_max
hope that helps
Kerry.