While not a true "script" it gets the job done and is relatively simple. Root is not required, you just need to install Tasker (a paid app with a 7 day trial).
To set it up create a new profile called 4G Alert, then setup the trigger by selecting State > Net > Mobile Network > check 4G.
It will then ask you to select a task to perform. Create a New Task, give it a name, add an action. You have freedom to do what you want here. Since I wanted to be able to know where on the map it connected, I had it send me a text message with a link to google maps.
To do this click the + sign > Phone > Send SMS. Enter your phone number, and put this link in the message line: http://maps.google.com/maps?q=%LOC
When this runs it will attempt to grab your location from the gps and insert it where %LOC shows up so naturally you'll need to leave your GPS enabled (or you could write another action to turn it on for you).
That's the basic profile. You can add more complicated things like notifications with audio. That depends more on your comfort with Tasker.