MV Anyone know why this isn't working, yanfly battle sequence

I'm trying to make an attack that adds a random debuff but for some reason,n it keeps on executing the else statement and setting the the buff to luck (luk) everytime
<target action>

var random = Math.floor(Math.random() * 6) + 1;

if random === 1

add atk debuff: target, 1, show

else if random === 2

add def debuff: target, 1, show

else if random === 3

add mat debuff: target, 1, show

else if random === 4

add mdf debuff: target, 1, show

else if random === 5

add agi debuff: target, 1, show

else

add luk debuff: target, 1, show

end

</target action>
variables declared like that dont exist past the line you create them on in action sequences. save the random result into a game variable and use that for your comparisons instead

Original thread: https://forums.rpgmakerweb.com/threads/anyone-know-why-this-isnt-working-yanfly-battle-sequence.176014/