If you have looked at schematics with discreet FETs in them being used as switches, you may have seen some with a resistor placed in series between the FET’s gate and whatever is driving it. Like this as an example.
The reason for R1’s existence is explained in why won’t my FET turn off, but what about R2?
Well, R2 is essentially there to limit the peak of the current burst in to the invisible gate-source capacitance discussed in why won’t my FET turn off, it will set a maximum current based on the source voltage and the resistor value selected based on Ohm’s law.
Why would a designer want to do this? One reason is that the designer may want to create a more “soft” turn on for the FET and subsequently the load being switched. By slowing the current flow to the invisible capacitor, the FET will switch from OFF to ON more slowly as well, and this could be desirable over a rapid turn on. Another is that the source of the gate voltage might be temporarily overloaded by the current burst being demanded by the FET’s gate, and a current limiting resistor is necessary to prevent problems for the source that may be caused by this. Sometimes even in fast switching gate drivers, such as for switching power supply circuits, a small series resistance is used to slightly slow down the switching for necessary improvements in EMI to pass certifications (such as for the FCC).