This is all wrong. You do not call the function inside of the function. So it should be like this
Sub Option:
self add_option("mainMods", "God Mode", ::godMode);
Function:
godMode()
{
if(godMode == false)
{
self enableInvulnerability();
}
else
{
self disableInvulnerability();
}
}
Hope this helped.