Compound exercises

Hi, I’m new here so hoping for a bit of initial guidance.

I was recently approached by a fitness instructor in my gym. He asked me what my goals are and I said to build moderate muscle whilst trying to get a bit leaner. He said I should work almost exclusively on compound exercises. Is this good advice?

Thanks in advance