Collision stops object

How do i make a walking character stop when it hits something?

thanks

OMG SENOCLUAR!!!

Ur a LEGEND!!! Im gonna like build an altar and worship you

ive been looking for this code for a long time, thanks heaps for this