local frame = CreateFrame("frame") frame:RegisterEvent("PLAYER_LOGIN") local function doStuff() -- do whatever you want end frame:SetScript("OnEvent", function() C_Timer.After(20, doStuff) end)