Moth Balls and Crystals do Kill Carpet Beetles when properly used but the Moth Balls and Crystals will not Repel the carpet beetles.
To get rid of carpet beetles you can sprinkle boric acid on the carpet and any upholstery where the carpet beetles are and let it sit for an hour or 2 in the carpet and if possible leave the boric acid in your carpet for up to 8 hours while you're gone to work and then when you come back you can vacuum the boric acid out of your carpet and upholstery along with the carpet beetles.
Then you should steam clean the carpet and upholstery to remove any boric acid that was left behind and it will also help to remove any further carpet beetles that may be stuck down in your carpet.
You can also use Apple Cider Vinegar in a carpet cleaner or Upholstery cleaner to kill off and get rid of carpet beetles naturally.
Apple Cider Vinegar is Toxic and deadly to carpet beetles so it's very effective.
Just mix some apple cider vinegar in with some water in your carpet or upholstery cleaner like you would with any other carpet cleaner and steam clean the carpets and upholstery with it.
If carpet beetles have gotten into your clothes then you can freeze the clothing and the carpet beetles will be killed.