applescript – Using Automator to set Music track as loved

I am new to Automator and AppleScript and I’m trying to do something I thought was fairly simply, using an AppleScript to set a track in Music to loved.

Here is the AppleScript I’m trying:

tell application "Music"
    set loved of current track to true
end tell

I am getting the following error when I try to run it:
Music got an error: Unknown object type.

I’ve seen a few guides where people used this command in Itunes and also in Music. Why doesn’t this work for me?