Having roblems with python...

So I’m making a UI for a game and I met a few problems, I solved most of them but this one got me.
I have this part of the script which causes the problem.

lif keyboard.getKeyStatus(bge.events.DOWNARROWKEY)==1:    if own["OPM"]:        
        if own['OPM-LEVEL']==1:  
            own['OPM-LEVEL']=2
        elif own['OPM-LEVEL']==2:
            own['OPM-LEVEL']=3
        elif own['OPM-LEVEL']==3:
            own['OPM-LEVEL']=4
        FadeObj = scene.objects[own["SELOPM"]]
        FadeObj.worldPosition.y -= 0.95
    elif own["NS"]:        
        if own['NGLEV']== 1:
            own['NGLEV']== 2
            VisObj = scene.objects[own["NGS1"]]
            VisObj.visible = False
            VisObj = scene.objects[own["NGS2"]]
            VisObj.visible = True	        
        elif own['NGLEV'] == 2:	 
            own['NGLEV'] == 3
            VisObj = scene.objects[own["NGS2"]]
            VisObj.visible = False
            VisObj = scene.objects[own["NGS3"]]
            VisObj.visible = True       
        elif own['NGLEV']== 3:
            own['NGLEV']== 4
            VisObj = scene.objects[own["NGS3"]]
            VisObj.visible = False
            VisObj = scene.objects[own["NGS4"]]
            VisObj.visible = True	
elif keyboard.getKeyStatus(bge.events.UPARROWKEY)==1:	
    if own["OPM"]:        
        if own['OPM-LEVEL']==2:
            own['OPM-LEVEL']=1
        elif own['OPM-LEVEL']==3:
            own['OPM-LEVEL']=2
        elif own['OPM-LEVEL']==4:
            own['OPM-LEVEL']=3
        FadeObj = scene.objects[own["SELOPM"]]
        FadeObj.worldPosition.y += 0.95	 
    elif own["NS"]:         
        if own['NGLEV']==2:
            own['NGLEV']==1
            VisObj = scene.objects[own["NGS2"]]
            VisObj.visible = False
            VisObj = scene.objects[own["NGS1"]]
            VisObj.visible = True	        
        elif own['NGLEV']==3:	 
            own['NGLEV']==2
            VisObj = scene.objects[own["NGS3"]]
            VisObj.visible = False
            VisObj = scene.objects[own["NGS2"]]
            VisObj.visible = True       
        elif own['NGLEV']==4:
            own['NGLEV']==3
            VisObj = scene.objects[own["NGS4"]]
            VisObj.visible = False
            VisObj = scene.objects[own["NGS3"]]
            VisObj.visible = True   

The ifs with the ‘OPM’ parts just work fine. They do what they should but when it comes to the ‘NS’ part it does nothing. It should make a few objects visible and others invisible and increase an integer.
OPM,NS=Boolean
NGLEV,OPM-LEVEL=Integer
NGS1-4,SELOPM=String with object name in them.

I can’t seem to find the problem. I don’t see any typos and the logic is okay too. Halp plox.

You know that if one of the if statements is executed the rest don’t get executed because they are elif’s right?

Ofc I know that. The NS part shouldn’t be executed if the OPM part is true. Thats why I used elif. Also I tried to switch them so the NS part would be checked first but didn’t work either.

Any ideas?

Could the misaligned indentation be the problem?

What changes the value of own[“NS”] ? Could it be it is never set to true when own[“OPM”] is false ?

I thought of the alignment but I checked it and it was okay.

NS is Change after pressing N and then S. Since the back option works fine it’s impossible that it was never set true.

Hm, really? It looks like the first elif own[“NS”]: line doesn’t got a matching if on the snippet you posted…

The copy just got messed up a little, but in the script itself there are no alignment problems.