Troubleshooting screenshot script
For the benefit of other readers, it's worth noting that Finder has builtin keyboard shortcuts that will allow you to:


⌃⌘⇧3: take a screenshot of a selection and save it to clipboard;
⌘⇧4: take a screenshot of a selection and save it to a file.


You can modify these shortcuts in System Preferences > Keyboard > Shortcuts > Screen Shots.

I've put a suggestion in the comments about how to begin diagnosing the original script.  But, as I would have written the script slightly differently if I wanted (for some reason) to avoid using the builtin Finder keyboard shortcuts, I went ahead and wrote it:

    set screenshots to do shell script "defaults read com.apple.screencapture location"
    set timestamp to do shell script "date +'%Y-%m-%d at %H.%M.%S'"
    set type to "jpg" -- or "png"
    set filename to ["Screen Shot ", timestamp, ".", type] as text

    do shell script "SCREENCAPTURE -ioac -t " &amp; type
    set [imgdata] to (the clipboard) as list

    tell application "Finder"
        set screenshot to (make new file ¬
            at POSIX file screenshots as alias ¬
            with properties {name:filename}) as alias

        write the imgdata as class of imgdata to the screenshot

        reveal the screenshot
    end tell


System info: AppleScript version: "2.7", system version: "10.13.4"

For one, the script is shorter, and shorter scripts provide fewer places where things can go wrong.  Currently, this script works fine on my system.  Therefore, you can try it on yours see if it works; if not, Script Editor will report where the errors are occurring and what they are, e.g. whether it is a file permissions error, etc.