We need to read in context, see below
37. Now when they heard this, they were cut to the heart, and said to Peter and the rest of the apostles, “Men and brethren, what shall we do?”
1. They were cut to the heart - Their conviction of when they realizes what they did to christ by hanging him on a cross was so deep, and so strong, that it cut into their heart,
2. They asked, what shall we do
38 Then Peter said to them, “Repent, and let every one of you be baptized in the name of Jesus Christ for the remission of sins; and you shall receive the gift of the Holy Spirit. 39 For the promise is to you and to your children, and to all who are afar off, as many as the Lord our God will call.”
40 And with many other words he testified and exhorted them, saying, “Be saved from this perverse generation.”
1. His response is to repent, To change your view, to confess, to be poor in spirit, To change from a state of unbelief to a state of belief
2. He then told those who did repent to be baptized as an outward testimony of an inward faith
3. He said those who repented would recieve remission of sin and the gift of the spirit (be born again) and this promise is not only to them, but to everyone who would come after (us)
41 Then those who gladly received his word were baptized; and that day about three thousand souls were added to them.
We finally see, those who recieved his word (recieved Christ) were baptized, as peter said asked them to do. Showing they had freely chose to repent and believe