Difference between ために and ように (purpose)
Both mean “in order to” or “so that.” ために goes with an action that the speaker can choose to do. ように goes with a state, an ability, or something outside your control.
A quick tip: before ように there is often a potential form (話せる), a negative form (忘れない) or a verb without will (見える, 治る). Before ために there is a willed verb in the dictionary form.