Hey.
The reason why it's not working is because you made your "combatcheck" local inside the onevent function. So every time the UNIT_AURA event fires, combatcheck will be false. Also, there a boolean data type you can use instead of string. (true/false without the quotation mark)
Try this:
Lua Code:
local combatcheck = false
textFrame:RegisterUnitEvent("UNIT_AURA", "player")
textFrame:RegisterEvent("PLAYER_REGEN_DISABLED")
textFrame:RegisterEvent("PLAYER_REGEN_ENABLED")
textFrame:SetScript("OnEvent", function(self, event, ...)
if event=="PLAYER_REGEN_DISABLED" then
combatcheck = true
elseif event =="PLAYER_REGEN_ENABLED" then
combatcheck = false
end
local count = 0
for buff in pairs(buffs) do
if UnitBuff("player", buff) then
count = count + 1
end
end
-- Give warning if need to reroll the bones
if not combatcheck then
textFrame:message("")
elseif UnitBuff("player", "True Bearing") or UnitBuff("player", "Shark Infested Waters") or count >= 2 then
textFrame:message("")
else
textFrame:message("REROLL THE BONES!!".." "..tostring(combatcheck))
end
end)