From clothing: If the item is bleach-safe, soak the stain in color-safe bleach for about 15 minutes. Wash normally, and allow to air-dry. If the stain remains, repeat the process, allowing the stain to soak for up to 30 minutes before laundering.
From carpet: Vacuum as much of the play dough as you can, or use a stiff brush to brush it up if it's dry. If there's still some left, dampen a cloth with hot water, put it on top of the play dough, and let it sit for an hour to soften it. Soft play dough is often easier to remove. You can also try sticking more play dough onto the bits stuck to the carpet. The new play dough might pull up the old from the carpet.