Indeed he succeeds who purifies his ownself (i.e. obeys and performs all that Allah ordered, by following the true Faith of Islamic Monotheism and by doing righteous good deeds).
And indeed he fails who corrupts his ownself (i.e. disobeys what Allah has ordered by rejecting the true Faith of Islamic Monotheism or by following polytheism, etc. or by doing every kind of evil wicked deeds).
Thamud (people) denied (their Prophet) through their transgression (by rejecting the true Faith of Islamic Monotheism, and by following polytheism, and by committing every kind of sin).
But the Messenger of Allah [Salih (Saleh)] said to them: "Be cautious! Fear the evil end. That is the she-camel of Allah! (Do not harm it) and bar it not from having its drink!"
Then they denied him and they killed it. So their Lord destroyed them because of their sin, and made them equal in destruction (i.e. all grades of people, rich and poor, strong and weak, etc.)!
IMPORTANT: All Scripture text has context and background. Scripture should never be read literally or in isolation. Always seek clarification from religious scholars and teachers. In general, Scripture adheres to four principles: (1) Literal Meaning - What the Scripture says (2) Historical Setting - The story events; how the Scripture was understood in its time (3) Grammar - The surrounding sentence and paragraph; textual context (4) Synthesis - A comparison with similar Scripture to give a better contextual understanding