Starting with version 16 Filemaker has enhanced security and doesn't allow to execute AppleScripts out of the box. The Filemaker website describes in detail what you have to do.

The extended privileges are explained at the Help topic for privileges.

In Filemaker with the open Filemaker archive go to the menu File->Manage->Security. After entering the username/password (admin/admin is the default) combination for the Filemaker archive change over to Extended Privileges: 

Select fmextscriptaccess and click on the Edit button. Make sure that the privileges look like the following: