Using X-ray diffuse scattering, we investigate the critical behavior of an order-disorder phase transition in a defective "skin-layer" of V2H. In the skin-layer, there exist walls of dislocation lines oriented normal to the surface. The density of dislocation lines within a wall decreases continuously with depth. We find that, because of this inhomogeneous distribution of defects, the transition effectively occurs at a depth-dependent local critical temperature. A depth-dependent scaling law is proposed to describe the corresponding critical ordering behavior.