There two main causes for the rattling noises heard in the Motorola Moto G 2nd Gen are loose buttons and poor quality vibration motors. To lower the effect of the rattling, some temporary solutions are to turn off vibration, or get a case that should reduce the noise.
If the cause is a loose button, then open up the back cover and place a piece of paper or tape in the area between the button and back cover.
If you think that the vibration motor is the cause, here is a repair guide: [http://forum.xda-developers.com/moto-g/help/guide-fix-annoying-bad-vibration-t2860152]