AppleScript get value of a button
I tested your code with "Notifications" and found that "get value" actually returns the "AXTitle" of button "Notifications" – NOT its "AXValue".

Therefore you must code:

if title of myNumberIs contains " (1)" then set myNumberIsAsInteger to 1


This works fine with me …