If you can't do what you want to do, do what you can.

Literal

Want-to-do thing [subject-が] cannot-do-[if-なければ] can-do thing [object-を] do [imperative-なさい].

An aphoristic life-advice sentence built on a parallel structure: したいこと ('the thing you want to do') vs 出来ること ('the thing you can do'). Both use the pattern [verb] + こと to nominalize. The conditional ~なければ ('if not') chains the conditional clause. The imperative なさい is a softer-than-direct command — typical of advice given by a teacher or parent.