Heavy metal ions stand out as highly toxic pollutants, playing a pivotal role in various human diseases. Consequently, the development of advanced detection methods becomes imperative for global public health. A proven and effective strategy for metal ion detection involves the use of fluorescent chemosensors. In this context, we synthesized metal–organic frameworks (MOFs) based on perylene to create potassium-based MOFs functioning as an efficient detection probe for metal ion detection. Proton nuclear magnetic resonance (NMR) spectral analysis revealed only two distinct types of hydrogen signals are observed from K4PTC, and no hydrogen signals originating from any residual K4PTC are detected. Similarly, In the 13C NMR spectra, the most downfield signal observed at 176.9 ppm is conveniently assigned to the carbonyl carbon of the K4PTC. The probe displayed diminished absorbance and fluorescence intensity upon the introduction of Cu2+ and Pb2+, suggesting K4PTC’s potential as a sensor for detecting these metal ions. The above findings indicate that loading metal ions into the K4PTC system weakens the oxygen-potassium interaction, signifying the interaction between the metal ions and our probe. Interestingly, the limit of detection (LOD) for our sensor material is highly effective for detecting these metal ions. Consequently, this research serves as a significant reference for the sensitive monitoring of metal pollutants in the environment.