Hitting

I need advice on what to do for a toddler who won’t stop hitting. Every time he hits I tell him no we don’t hit that hurts and then I try telling him it’s okay to feel angry but it’s not okay to hit. Well I’ve been doing that for months and it’s not working and the other day we were at a kids museum and he was exhausted and then started hitting other children! I grabbed him told him that wasn’t okay and we left. Please I’m begging anyone for advice on what to do because clearly what I’m doing isn’t working 😩 it’s one thing for him to hit us but I will not allow him to hit other children. I know it’s developmentally appropriate for his age but it has to stop. Anyone one else going through this?