The word of God presents the following idea, “
whoever fears Him and works righteousness is accepted by Him”.
Act 10:34-35 Then Peter opened his mouth and said: "In truth I perceive that God shows no partiality. But in every nation whoever fears Him and works righteousness is accepted by Him.
Cornelius was chosen by God to be the first to receive the Holy Spirit, due to his, prayers and good works.
Act 10:4 And when he observed him, he was afraid, and said, "What is it, lord?" So he said to him, "Your prayers and your alms have come up for a memorial before God.
We see this idea in the dialog, between Jesus and his disciples. When talking about who will receive the Holy Spirit, there is a distinction between those who “choose rightly”, and those who “choose to sin”. The first work being:
Joh_6:29 Jesus answered and said to them, "This is the work of God, that you believe in Him whom He sent."
Joh 14:15-24 "If you love Me, keep My commandments. And I will pray the Father, and He will give you another Helper, that He may abide with you forever— the Spirit of truth, whom the world cannot receive, because it neither sees Him nor knows Him; but you know Him, for He dwells with you and will be in you. I will not leave you orphans; I will come to you. "A little while longer and the world will see Me no more, but you will see Me. Because I live, you will live also. At that day you will know that I am in My Father, and you in Me, and I in you. He who has My commandments and keeps them, it is he who loves Me. And he who loves Me will be loved by My Father, and I will love him and manifest Myself to him." Judas (not Iscariot) said to Him, "Lord, how is it that You will manifest Yourself to us, and not to the world?" Jesus answered and said to him, "If anyone loves Me, he will keep My word; and My Father will love him, and We will come to him and make Our home with him. He who does not love Me does not keep My words; and the word which you hear is not Mine but the Father's who sent Me.
Romans also states there is no partiality with God, those who do evil will perish, and those who do good receive life.
Rom 2:2-11 But we know that the judgment of God is according to truth against those who practice such things. And do you think this, O man, you who judge those practicing such things, and doing the same, that you will escape the judgment of God? Or do you despise the riches of His goodness, forbearance, and longsuffering, not knowing that the goodness of God leads you to repentance? But in accordance with your hardness and your impenitent heart you are treasuring up for yourself wrath in the day of wrath and revelation of the righteous judgment of God, who "WILL RENDER TO EACH ONE ACCORDING TO HIS DEEDS": eternal life to those who by patient continuance in doing good seek for glory, honor, and immortality; but to those who are self-seeking and do not obey the truth, but obey unrighteousness—indignation and wrath, tribulation and anguish, on every soul of man who does evil, of the Jew first and also of the Greek; but glory, honor, and peace to everyone who works what is good, to the Jew first and also to the Greek. For there is no partiality with God.
1Pe 1:17 And if you call on the Father, who without partiality judges according to each one's work, conduct yourselves throughout the time of your stay here in fear;
2Co 4:6 For it is the God who commanded light to shine out of darkness, who has shone in our hearts to give the light of the knowledge of the glory of God in the face of Jesus Christ.
We see that God gives the light of his words to all people.
Joh_1:9 That was the true Light which gives light to every man coming into the world.
Joh_12:36 While you have the light, believe in the light, that you may become sons of light." These things Jesus spoke, and departed, and was hidden from them.
We see there is a time when people have that light, as stated “While you have the light”.