〜ように言う
tell (someone) to, ask (someone) to
Verb dictionary / ない-form + ように + 言う · 頼む · 注意する
Sign up free to review this point on a spaced schedule.
To report an instruction or request, put ように after the verb and follow it with 言う, 頼む (ask) or 注意する (warn): 先生は学生に静かにするように言いました, "the teacher told the students to be quiet".
For "told not to", use the ない-form: 医者にお酒を飲まないように言われた, "the doctor told me not to drink".
It reports the instruction rather than quoting it, so it's softer and more indirect than 静かにしろと言った.
With the passive 言われる, it's how you say "I was told to": 早く来るように言われました.
The same ように on its own can end a notice as an instruction: 遅れないように, "don't be late".
Examples
先生は学生に静かにするように言いました。
The teacher told the students to be quiet.
医者にお酒を飲まないように言われた。
The doctor told me not to drink.
母に早く帰るように言われました。
My mother told me to come home early.
友達に駅で待つように頼みました。
I asked my friend to wait at the station.
部長に遅れないように注意されました。
My manager warned me not to be late.