A weakened form of the pathogen is released into your system via a vaccine. This will allow your immune system to recognize the illness and fight it off. Of course you can still get the illness but it’ll be a less severe form of it. Vaccines are effective
People don’t realize that the MMR and Varicella are the only vaccines that are widely used which aren’t attenuated. And they are arguably the most effective