Turning off my VPN with Applescript

Hey there,
I'm using a Stream Deck and, because NordVPN doesn't have a key command to toggle the vpn (I mean why would they?) I'm using some KM gui magic. Run into a problem. It does the job but, new to AS, I can't work out how to get an output that I can use to tell Streamdeck to change the icon depending on whether it's on or off.

tell application "System Events"
tell application process "Dock"
	tell list 1
		tell UI element "NordVPN IKE"
			perform action "AXShowMenu"
			tell menu "NordVPN IKE"
				if menu item "Disconnect" exists then
					tell menu item "Disconnect"
						perform action "AXPress"
					end tell
				else
					tell menu item "Quick connect"
						perform action "AXPress"
						set connected to true
					end tell
				end if
			end tell
		end tell
	end tell
end tell

end tell
return connected

that's my code. And it's turning it off and on but it's not giving me the alerts. I think I'm using Boolean and variables wrong.

I'm no AppleScript expert either but I can see that you should have

set connected to false

in your code block

tell menu item "Disconnect"

To be certain of what's being returned, test and display the value of isconnected to make sure your If action will work properly.