Nothing is perfect, but being vaccinated strongly reduces your chances of a) getting infected in the first place; and then b) thus passing it on to someone else.
https://www.healthline.com/health-news/getting-a-pfizer-or-m...
> A new CDC study provides strong evidence that mRNA COVID-19 vaccines are highly effective in preventing SARS-CoV-2 infections in real-world conditions
https://www.cdc.gov/media/releases/2021/p0329-COVID-19-Vacci...