Clamping camera changes to world space

I need help. I’m making a game with plots and I want it to be so the camera can’t move off the plot. I tried using come code but for some reason, it changes it to local space.

Code:

local cf = CameraPart.CFrame * CFrame.new(
					0,
					0,
					-0.05
				)
				local clampcf = CFrame.new(
					math.clamp(cf.X,X0,X1),
					cf.Y,
					math.clamp(cf.Z,Z0,Z1)
					
				)
				CameraPart.CFrame = clampcf

It is when the W or Up arrow pressed.

I am not good at programming so this may be a dumb question.