I need help with my phone...this is urgent i have a rooted phone.i recently tried download the modded play store but it failed resulting in my phone not having a proper google play store and google framework was buggered.i kept getting the 'unfortunately com.google.gapps has stopped' error so i decided to factory reset my device.once i put it on again for the initial setup,i got the same 'unfortunately com.google' message.i tried to finish the initial setup by constantly closing the message but only could get to the wifi part and it would get stuck and reboot right back to the initial setup.please help me with my issue...thanks

note:i have a rooted moto g(2015) and can still access TWRP
Unfortunately, you did this to yourself... flashing a "modified" gapps package that is not known to work with your device can cause unknown conditions. These packages are applied to the system, so a factory reset will not correct them

You have 3 choices to correct this:

1) Restore a previous backup from TWRP if you have one. If you do not, once your device is operational again I suggest maintaining regular backups in TWRP.

2) You can attempt to flash a known working Gapps package from OpenGapps. Make sure to select the correct Platform (ARM), Android (5.1 or 6.0 whichever applies), and Variant... The variant part will be the toughest, I would suggest using Mini, or possibly Full, as the stock Moto gapps fall somewhere in between those 2 packages. Remember to wipe caches/dalvik before rebooting.

3) The final option means a total factory reflashing using the stock images. Stock images and instructions for flashing can be obtained from XDA in the Moto G (3rd Gen) Factory Firmware Images thread. Be ABSOLUTELY sure you have the correct model and version for your device, flashing the incorrect version can have... umm... lets just say "undesirable effects". If this method is chosen, you can likely upgrade your device to Marshmallow in the process, but remember that you can go up in version with the factory images, but downgrading is not recommended.

One of these three options will correct the problem, as long as you follow the instructions properly. Again, this is another friendly reminder to backup on a regular basis and before making significant changes, it is easier to revert to a known working system that is a few hours, days, or even weeks old then to start from scratch.