Help?

Hey everyone so I’ve been talking to this guy and he’s amazing!!! However he told me tonight he does have herpes, that he found out a couple month ago. Now this scared me at first because I do not have herpes or anything else, however I still wanna continue talking with him and maybe being together, but I wanna know some more information about herpes, if we have sex how do I prevent not getting it?