1. I'm new with programming lua (but not with programming itself) and i thought about making my own addons so started with something simple like saying something when i enter arena. i have been trying for hours to get it to work so i thought some help might be nice. here is the code.

     function ZONE_CHANGED_NEW_AREA()
        local ArenaChecked = select(2, IsInInstance())
        if (ArenaChecked == "arena") then
            SendChatMessage("worked", "SAY", nil)
        end
    
     end
    
  2. I'm new with programming lua (but not with programming itself) and i thought about making my own addons so started with something simple like saying something when i enter arena. i have been trying for hours to get it to work so i thought some help might be nice. here is the code.

     function ZONE_CHANGED_NEW_AREA()
      local ArenaChecked = select(2, IsInInstance())
      if (ArenaChecked == "arena") then
          SendChatMessage("worked", "SAY", nil)
      end
      
     end
    

    You should read the section of the book on event based programming. You can't just simply create a function and expect that it will be called. To register for an event, you must create a frame:

     MyZoneChangeFrame = CreateFrame("Frame")
    

    Register that frame for an event:

     MyZoneChangeFrame:RegisterEvent("ZONE_CHANGED_NEW_AREA")
    

    And then set an OnEvent script for that frame, that will be called whenever a registered event fires:

     function MyZoneChanged_OnEvent(self, event, ...)
       print("Event handler for  " .. event .. ".")
       print("Arguments: ", ...)
     end
    
     MyZoneChangeFrame:SetScript("OnEvent", MyZoneChange_OnEvent) 
    

    Now, when that event fires, your handler function will be called to handle the event.