function() FriendlyPlayerNameplateIds = {} local pointer = 1 for i = 1, 40 do if UnitIsPlayer("nameplate" .. i) == true then FriendlyPlayerNameplateIds[pointer] = i pointer = pointer + 1 end end end UnitIsFriend("player", "nameplate" .. i) function() local output = "" for k,v in ipairs(FriendlyPlayerNameplateIds) do if UnitName("nameplate" .. v) ~= nil then output = output .. string.match(UnitName("nameplate" .. v), "%a+") .. " " .. UnitHealth("nameplate" .. v) .. "/" .. UnitHealthMax("nameplate" .. v) .. "\n" end end return output end function() local output = "" FriendlyPlayerNameplateIds = {} local pointer = 1 for i = 1, 40 do if UnitIsPlayer("nameplate" .. i) == true then FriendlyPlayerNameplateIds[pointer] = i pointer = pointer + 1 output = output .. i .. " " .. string.match(UnitName("nameplate" .. i), "%a+") .. "\n" end end output = output .. "\n\n\n" for k,v in ipairs(FriendlyPlayerNameplateIds) do output = output .. k .. " " .. v .. "\n" end return output end local f = CreateFrame("Button", "name", UIParent, "SecureUnitButtonTemplate") f:SetAttribute("unit", "player") -- or whatever unit you're making f:EnableMouse(true) f:SetSize(100, 20) -- width 100, height 20 f:SetAllPoints(WeakAuras.regions[aura_env.id].region) f:RegisterForClicks("LeftButtonUp", "RightButtonUp") f:SetAttribute("type1", "target") -- Left click targets unit f:SetAttribute("type2", "togglemenu") -- Right click opens the context menu