Hi I'm trying to make a button appear/disapper when target buff it self but I can't find any command that could return the buff it is using, tried UnitBuff("target",id) and UnitDebuff("target",id) but they only return nil
Code:
function debuffenemybars()
M=0
local i=1;
local name, x2, x3, x4, myBuffType = UnitBuff("target",i)
while ( name ~= nil ) do
if ( myBuffType == "Magic") then
M=M+1
end
DEFAULT_CHAT_FRAME:AddMessage("Antal" ..M)
i=i+1
name, x2, x3, x4, myBuffType = UnitBuff("target",i)
end
if M==0 then
barstate(DebuffEnemyBar,0);
end
if M>=1 then
barstate(DebuffEnemyBar,1);
end
end
any ideas?