How do I click a button using AppleScript?

Solution 1:

You also need to specify the parent objects.

activate application "TeamSpeak 3 Client"
tell application "System Events" to tell process "TeamSpeak 3"
    click menu item "Connect" of menu "Connections" of menu bar 1
    click button "Connect" of window 1 of window 1
end tell