Photocatalytic H2O2 production is an environmentally friendly and sustainable production technique. Here, we fabricate the Ti3C2 quantum dot-modified defective inverse opal g-C3N4 (TC/CN) via a facile electrostatic self-assembly method. The resultant catalysts greatly facilitate the photocatalytic H2O2 production. The optimum H2O2 yield on TC/CN-20 reaches 560.7 μmol L–1 h–1, which is 9.3 times higher than that of bulk CN under visible light irradiation. This enhancement is attributed to the direction-induced bonding between carbon vacancies in g-C3N4 and TCQDs. The formation of a Schottky junction in the interface further realizes spatial separation of electron and holes, effectively avoiding the recombination of the charge carriers at defect sites. Therefore, this work not only constructs a high-performance photocatalyst for H2O2 production with outstanding yield and long-term recyclability but also develops a direction-induced bonding synthetic method and explores the functionary mechanism of defect sites in the Schottky junction for photocatalytic H2O2 production.