Praise be to Allah.
Undoubtedly committing sin is one of the causes of Allaah’s wrath and of loss of blessing and withholding of rain and being overtaken by the enemy. Allaah says (interpretation of the meanings):
“And indeed We punished the people of Fir‘awn (Pharaoh) with years of drought and shortness of fruits (crops), that they might remember (take heed)”
“So We punished each (of them) for his sins, of them were some on whom We sent Haasib (a violent wind with shower of stones) [as on the people of Loot (Lot)], and of them were some who were overtaken by As-Sayhah [torment — awful cry, (as Thamood or Shu‘ayb’s people)], and of them were some whom We caused the earth to swallow [as Qaaroon (Korah)], and of them were some whom We drowned [as the people of Nooh (Noah), or Fir‘awn (Pharaoh) and his people]. It was not Allaah Who wronged them, but they wronged themselves”
There are many similar aayahs. And it was narrated in a saheeh hadeeth that the Prophet (peace and blessings of Allaah be upon him) said: “A person may be deprived of provision because of sins that he commits.” So each Muslim man and woman must beware of sin, and must repent from sins that they have committed in the past, whilst also thinking positively about Allaah, hoping for His forgiveness and fearing His wrath and punishment. Allaah says in His Holy Book about His righteous slaves:
“Verily, they used to hasten on to do good deeds, and they used to call on Us with hope and fear, and used to humble themselves before Us”
[al-Anbiya’ 21:90 – interpretation of the meaning]
And Allaah says (interpretation of the meaning):
“Those whom they call upon [like ‘Eesa (Jesus) - son of Maryam (Mary), ‘Uzayr (Ezra), angel and others] desire (for themselves) means of access to their Lord (Allaah), as to which of them should be the nearest; and they [‘Eesa (Jesus), ‘Uzayr (Ezra), angels and others] hope for His Mercy and fear His Torment. Verily, the Torment of your Lord is (something) to be afraid of!”
“The believers, men and women, are Awliyaa’ (helpers, supporters, friends, protectors) of one another; they enjoin (on the people) Al-Ma‘roof (i.e. Islamic Monotheism and all that Islam orders one to do), and forbid (people) from Al-Munkar (i.e. polytheism and disbelief of all kinds, and all that Islam has forbidden); they perform As-Salaah (Iqaamat-as-Salaah), and give the Zakaah, and obey Allaah and His Messenger. Allaah will have His Mercy on them. Surely, Allaah is All-Mighty, All-Wise”
It is prescribed, however, for Muslim men and women also to pursue the means that Allaah has permitted, placing their hope in Him and fearing Him, pursuing the means whilst also putting their trust in Allaah and depending on Him to bring what they hope for and keep them safe from what they fear, for He is the Ever-Responsive and Most Generous who says (interpretation of the meaning):
“And whosoever fears Allaah and keeps his duty to Him, He will make a way for him to get out (from every difficulty).
“and whosoever fears Allaah and keeps his duty to Him, He will make his matter easy for him”
“And all of you beg Allaah to forgive you all, O believers, that you may be successful”[al-Noor 24:31]
So you must repent to Allaah from whatever sins you have committed in the past and be steadfast in obeying Allaah, whilst thinking positively of Him and fearing His wrath. Be of good cheer and have the hope of a good end