Be careful not to get into trouble.

Literal

Troublesome thing-[to-に-not-なら-so-that-よう] be-careful-[command-なさい].

An ~ないように frame built around the abstract 'troublesome thing' — the same construction as 黙っていなさい-style admonitions but now warning against an outcome rather than a behaviour. The key lesson: ように can attach to almost any clause to mark a purpose or goal, including a state of affairs the speaker wants to avoid.