Too exhausted to scold, move hooks outside of hooked events/frames/functions.
Like so, and problem solved(maybe? not tested).
Lua Code:
--removed stuff with no purpose
hooksecurefunc("CompactUnitFrame_UpdateName", function (frame)
--Set the tag based on UnitClassification, can return "worldboss", "rare", "rareelite", "elite", "normal", "minus"
local tag
local level = UnitLevel(frame.unit)
if UnitClassification(frame.unit) == "worldboss" or UnitLevel(frame.unit) == -1 then
tag = BossTag
level = "??"
elseif UnitClassification(frame.unit) == "rare" or UnitClassification(frame.unit) =="rareelite" then
tag = RareTag
elseif UnitClassification(frame.unit) == "elite" then
tag = EliteTag
else
tag = ""
end
--Set the nameplate name to include tag(if any), name and level
frame.name:SetText(UnitName(frame.unit).." ("..level..")"..tag)
end)
-- deleted whatever was here