Check that all issues that this one is blocked by are resolved. You might want to put this on the Resolve Issue transition.

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.link.IssueLink

def linkType = ["Blocks"]

def linkMgr = ComponentAccessor.getIssueLinkManager()
for (IssueLink link in linkMgr.getInwardLinks(issue.id)) {
    if (linkType.contains(link.issueLinkType.name)) {
        if (! link.sourceObject.resolutionId) {
            passesCondition = false
        }
    }

}

For how-to questions please ask on Atlassian Answers where there is a very active community. Adaptavist staff are also likely to respond there.

Ask a question about ScriptRunner for JIRA, for for Bitbucket Server, or for Confluence.