If the roof flashing is damaged or nearing the end of its lifespan, it's generally a good idea to replace it when you're replacing your shingles. However, if the flashing is in good condition, it may not need to be replaced.