How does the damage to an aircraft’s black box affect accident investigations?

I want to understand what role the black box plays in investigating aircraft accidents, and what challenges arise if it is damaged during a crash.