Walls For a Tank

I need to script a building so that when my tank mc hits it, it doesnt go through it. my mcs name is is barrel. so yeah if anyone can help me with that would be good. Thanks in advance