1. I'm trying to get my addon to play a sound depending on the user's race and gender.

    I know that UnitRace and UnitSex are used here, and that UnitSex returns a number (2=male, 3=female).

    However, I'm not sure how to get it working.

    What I have so far is:

     local race=UnitRace("player")
     local gender_code=UnitSex("player")
     -- If player is a Tauren Male, do something.
     if race=="Tauren" and gender_code=="2" then
     local soundFile = "SOUND HERE"
     SendAddonMessage("VGC", soundFile, "RAID")

    I don't see anything wrong with it, but then again - I'm not the expert.

    Thanks again!

    UnitGender() returns a number, not a string.

     > print("3" == 3)

    Ah, I see.

    Now the problem I've got is my sound not playing.

    I'm using the same code you gave me before, except I've changed it (renamed a frame, new message, etc).

     if not ReceiveSoundFrameMana then
        ReceiveSoundFrameMana = CreateFrame("Frame")
     local function OnEvent(self, event, prefix, message, channel, sender)
        if prefix == "VGCM" then
           print("|cFF00FF00VGComms:|r " ..sender .. "|cFF98CDCD is low on mana!|r")
     local frame = ReceiveSoundFrameMana
     frame:SetScript("OnEvent", OnEvent)
            local soundFile = "Sound\\Character\\Tauren\\TaurenMaleVocal\\TaurenMaleOutOfMana01.wav"
            SendAddonMessage("VGCM", soundFile, "RAID")

    I don't see anything specifically wrong with it. You should always add debugging code to help figure out what's going on so you can answer the following questions:

    1. Is the addon message sent and received?
    2. Is the event handler being called?
    3. What specifically is not working, i.e. which line of code is the problem.