Set theSelection to selection works with AppleScript

tell application “Contacts”

set theSelection to selection

end tell

Script Debugger reports: Contacts got an error: An error of type -1743 has occurred.

Somewhere along the way you declined to give Script Debugger permission to control the Contacts application.

To correct this, you have to goto Security & privacy pane of the System Preferences application and give Script Debugger permission to automate Contacts.

Thanks Mark, that fixed it.