Alright, haven't really used animationgroups before so I just found it weird to be used like this.
One thing tho, to avoid spamming the loading process, run :Play() on PLAYER_LOGIN.
Lua Code:
local function Update(frame)
-- do whatever
end
local index = 1
local handler = CreateFrame('Frame')
handler:RegisterEvent('PLAYER_LOGOUT')
handler:RegisterEvent('PLAYER_LOGIN')
local animation = handler:CreateAnimationGroup()
animation:CreateAnimation():SetDuration(1/3)
animation:SetLooping('REPEAT')
animation:SetScript('OnLoop', function()
if(t9e5e5rb and _G['NamePlate' .. t9e5e5rb]) then
index = t9e5e5rb
t9e5e5rb = nil
end
while(_G['NamePlate' .. index]) do
local frame = _G['NamePlate' .. index]
frame:HookScript('OnShow', Update)
Update(frame)
index = index + 1
end
end)
handler:SetScript('OnEvent', function(self, event)
if(event == 'PLAYER_LOGIN') then
animation:Play()
else
t9e5e5rb = index
end
end)