I cannot see a clearly difference about the usage, and how to difference it.
I think that ために is used for the purpose of doing something, and ように indicates that have the possibility of doing something. But i'm not sure about if that's right.
And also I`m not sure about how to use のに
Hope someone can clarify and provide some examples!

