As far as I know, you cannot assign a keycommand to a script via the normal keycommands dialog. You need to “manually” edit your keycommands_en.json file (where “en” is your keyboard’s language, so it can be something else in your case).
This thread, for example, is talking about this topic, but there must be some more detailed ones:
On Windows, the path is C:\Users\*YOU*\AppData\Roaming\Steinberg\Dorico 5\keycommands_en.json