When location=0 you're swapping meshes and then set location=1 which is then immediately caught by the next if statement which switches the meshes back! Use:
If location
; Location = 1
Else
; Location = 0
EndIf
If location
; Location = 1
Else
; Location = 0
EndIf