The effect of resonant magnetic perturbations (RMPs) on particle confinement is studied in J-TEXT tokamak by using externally applied rotating RMPs. It is found that RMPs cause improved (degraded) particle confinement when its frequency is higher (lower) than the natural m/n = 2/1 tearing mode frequency, and the amount of change in electron density is proportional to the difference between these two frequencies, where m and n are the poloidal and toroidal mode number, respectively. These results reveal the important role of the relative rotation between RMPs and the electron fluid in affecting the particle confinement. The experimental results are compared to numerical ones based on nonlinear two-fluid equations, and quantitative agreement is found.