Bad behavior

I have a 2 year old, I usually opt for the “ignore it and it’ll go away” parenting style when it comes to things I would describe as annoying vs. actual naughty behavior. And it works for us but what I have a hard time is having him understand me when I tell him not to hit or to share. Any tips moms? I haven’t had any luck communicating with my tot when I’d like him not to do something