Need some help .LUA (WarMenu)

Hey, i’m getting some trouble trying to make a godmode on/off button using the menu.

	local playerPed = GetPlayerPed(-1)
	local godmode = false

	WarMenu.CreateMenu('test', 'ADM')
    WarMenu.CreateSubMenu('closeMenu', 'test', 'Are you sure?')

    while true do
        if WarMenu.IsMenuOpened('test') then
            if WarMenu.CheckBox('Checkbox', checkbox, function(checked)
                end) then
                    -- Do your stuff here
			elseif WarMenu.MenuButton('God Mode', 'test') then
						drawNotification('God Mode:~g~ON')
						SetEntityInvincible(GetPlayerPed(-1), (godmode == false))
						SetPlayerInvincible(PlayerId(), (godmode == false))
						local godmode = true

i want to turn the godmode OFF using the same button, wha’ts wrong here? I can enablethe godmode but i cant disable i’m sorry if it’s something stupid, just started messing around with this.

post this on the warmenu topic OR tag the creator. That would be the best place to start : )

			elseif WarMenu.MenuButton('God Mode', 'test') then
                        godmode = not godmode
                        if godmode then
						    drawNotification('God Mode:~g~ON')
						    SetPlayerInvincible(GetPlayerPed(-1), true)
                        else
                            drawNotification('God Mode:~g~OFF')
                            SetPlayerInvincible(GetPlayerPed(-1), false)

But like @J.Manlet said:

Next time :wink: