Method 1
First use a knife to scrape off as much chocolate as possible if it has already dried then vacuum the area to get rid of any extra flakes. Cover the area with paper towels then use your clothing iron on its lowest possible setting to heat the area so the chocolate will begin to stick to the towels. Make sure you don't burn your carpet while ironing or risk burning your carpet which could end much worse than a chocolate stain. Keep repeating these steps until there's nothing left and if there are any stubborn spots use a household cleaner to get rid of any more residue.
Method 2
use the knife again to scrape of as much as possible and using a white cloth or carpet stain removal try and lift the chocolate stain. If there's still some stain there use a half teaspoon white detergent mixed with a cup of water directly on the stain. Start blotting the carpet working the outer edge of the stain to the inner part. This makes sure you don't spread the stain further. Leave the area to dry and repeat if you need to and the stain should disappear.
Method 3
Run water directly over the carpet stain and rub with a clean cloth and some dish washing detergent then let is sit for a few minutes. Keep repeating until the stains gone. This method takes the longest but with enough time the stain should disappear.

