Or, an edit to Fizzlemizz's code (that is more relevant to what you are learning):
Lua Code:
local f = CreateFrame("Frame") --oh, and there was a typo here
f:SetScript("OnEvent", function(self, event, addon)
if addon == "YourAddonNameHere" then
if SimpleMap == 1 then
PlayerMovementFrameFader.AddDeferredFrame(WorldMapFrame, .3, 3.0, .5)
elseif SimpleMap == 3 then
PlayerMovementFrameFader.AddDeferredFrame(WorldMapFrame, 1, 3.0, .5)
end
end
end)
f:RegisterEvent("ADDON_LOADED")
https://wow.gamepedia.com/AddOn_loading_process