i dont have 1.12.1 client at the moment but try this.
local f = CreateFrame("frame");
f:RegisterEvent("UNIT_HEALTH")
f:RegisterEvent("UNIT_MANA")
f:SetScript('OnEvent', function()
if arg1 ~= "player" then return end
if UnitHealth("player") < UnitHealthMax("player") or UnitMana("player") < UnitManaMax("player") then
PlayerFrame:SetAlpha(1)
PetFrame:SetAlpha(1)
elseif UnitHealth("player") == UnitHealthMax("player") and UnitMana("player") == UnitManaMax("player") then
PlayerFrame:SetAlpha(0)
PetFrame:SetAlpha(0)
end
end)