Is going off script still allowed when making a flick?

I've heard that there were several films back then where an actor would just say something that wasn't in the script for a motion picture and the result is quite good, but that doesn't seem to be the case now.