Mothballs do repel rats. Cotton balls soaked in peppermint oil or a mixture of cayenne pepper, garlic, salad oil and horseradish also repel rats.
The mixture should be left sitting for 4 days and then strained into a spray bottle for use on the area where it's needed.
Other ways to help prevent wildlife from inhabiting property include pouring ammonia or pepper into outdoor trash cans and bringing pet bowls in at night. If a wild-animal nest is found on property, placing an ammonia-soaked rag and/or a loud radio near the nest may get rid of the animals. A bright light shone on the area may also work.