[XenoScript] Rook chain armor.lua: unexpected symbol near 'then'

PHP Code:
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------

    
MPotID 7876 --- mana potion ID
    MinMPots 
10 ---- if less then script will exit spawn
    MPots 
20 ----- amount to refill
    MPotprice 
50 ---- price of 1 single mana pot

-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------

registerEventListener(WALKER_SELECTLABEL"onWalkerSelectLabel")

function 
onWalkerSelectLabel(labelName)
    if (
labelName == "Checker"then
        
if (Self.Cap() < MinCap) or ((Self.ItemCount(MPotID) < MinMPots)) then<- this one
            gotoLabelz
(Leave)
        else
            
gotoLabel('Keep Hunting')
    
end 
    
    
elseif (labelName == "Sell"then
        delayWalker
(5000)
        
Self.Say("hi")
        
sleep(math.random(7001400))
        
Self.ShopSellItem(itemsell)
        
sleep(math.random(7001400))
    
end 
end

    
elseif (labelName == "potions"then
            setWalkerEnabled
(false)
            
wait(9001200)
            
Self.ShopSellItem(285sell)
            
wait(9001200)
            
buyAlotOfItemsBecauseItsSuchAGodDamnBigDeal(MPotID, (MPots-Self.ItemCount(MPotID)))
            
wait(9001200)
            
setWalkerEnabled(true)
    
end 
end